Skip to content

Commit

Permalink
fix: narrow type for add and subtract
Browse files Browse the repository at this point in the history
  • Loading branch information
susiwen8 committed Jul 13, 2021
1 parent 5a79cc6 commit 5138e07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<UnitTypeLong, 'date'> | 'w' | 'week' | 'quarter' | 'Q';
class Dayjs {
constructor (config?: ConfigType)
/**
Expand Down Expand Up @@ -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.
* ```
Expand All @@ -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.
* ```
Expand Down

0 comments on commit 5138e07

Please sign in to comment.