From 16869621b1a42563064dbf87f80c1ebfd74c1188 Mon Sep 17 00:00:00 2001 From: susiwen8 Date: Sat, 31 Jul 2021 11:22:43 +0800 Subject: [PATCH] fix: narrow type for `add` and `subtract` (#1576) --- types/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index d5ce14a2f..5141e2335 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -29,7 +29,7 @@ declare namespace dayjs { export type OpUnitType = UnitType | "week" | "weeks" | 'w'; export type QUnitType = UnitType | "quarter" | "quarters" | 'Q'; - + export type ManipulateType = Omit; class Dayjs { constructor (config?: ConfigType) /** @@ -237,7 +237,7 @@ declare namespace dayjs { * * Docs: https://day.js.org/docs/en/manipulate/add */ - add(value: number, unit?: OpUnitType): Dayjs + add(value: number, unit?: ManipulateType): Dayjs /** * Returns a cloned Day.js object with a specified amount of time subtracted. * ``` @@ -247,7 +247,7 @@ declare namespace dayjs { * * Docs: https://day.js.org/docs/en/manipulate/subtract */ - subtract(value: number, unit?: OpUnitType): Dayjs + subtract(value: number, unit?: ManipulateType): Dayjs /** * Returns a cloned Day.js object and set it to the start of a unit of time. * ```