From 5138e0705536977949dd517c3f63dc671f3335a0 Mon Sep 17 00:00:00 2001 From: susiwen8 Date: Wed, 14 Jul 2021 00:05:14 +0800 Subject: [PATCH] fix: narrow type for `add` and `subtract` --- 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..666f65709 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 = UnitTypeShort | Omit | 'w' | 'week' | 'quarter' | 'Q'; 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. * ```