Skip to content

Commit

Permalink
fix: narrow type for add and subtract (#1576)
Browse files Browse the repository at this point in the history
  • Loading branch information
susiwen8 committed Jul 31, 2021
1 parent 63de2a8 commit 1686962
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 = Omit<OpUnitType, 'date' | 'dates'>;
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 1686962

Please sign in to comment.