Skip to content

Commit bf419cf

Browse files
committed
Add types from index to quarterOfYeari
Resolves an issue where a variable being passed in as unit that may conform to *either* the base function's expected type (e.g., ManipulateType) *or* the augmented function's type (QUnitType) would be considered a type violation
1 parent 3738cc1 commit bf419cf

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

types/plugin/quarterOfYear.d.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { PluginFunc, ConfigType, QUnitType, OpUnitType } from 'dayjs'
1+
import {
2+
PluginFunc,
3+
ConfigType,
4+
ManipulateType,
5+
QUnitType,
6+
OpUnitType
7+
} from 'dayjs'
28

39
declare const plugin: PluginFunc
410
export = plugin
@@ -9,18 +15,18 @@ declare module 'dayjs' {
915

1016
quarter(quarter: number): Dayjs
1117

12-
add(value: number, unit: QUnitType): Dayjs
18+
add(value: number, unit: QUnitType | ManipulateType): Dayjs
1319

14-
subtract(value: number, unit: QUnitType): Dayjs
20+
subtract(value: number, unit: QUnitType | ManipulateType): Dayjs
1521

1622
startOf(unit: QUnitType | OpUnitType): Dayjs
1723

1824
endOf(unit: QUnitType | OpUnitType): Dayjs
1925

20-
isSame(date?: ConfigType, unit?: QUnitType): boolean
26+
isSame(date?: ConfigType, unit?: QUnitType | OpUnitType): boolean
2127

22-
isBefore(date?: ConfigType, unit?: QUnitType): boolean
28+
isBefore(date?: ConfigType, unit?: QUnitType | OpUnitType): boolean
2329

24-
isAfter(date?: ConfigType, unit?: QUnitType): boolean
30+
isAfter(date?: ConfigType, unit?: QUnitType | OpUnitType): boolean
2531
}
2632
}

0 commit comments

Comments
 (0)