Type error with the quarterOfYear plugin
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
**quarter** and **week** not supported in when using **quarterOfYear** plugin
See error from example https://codesandbox.io/s/dayjs-types-forked-v4t64b?file=/src/index.ts
```
No overload matches this call.
Overload 1 of 2, '(value: number, unit: QUnitType): Dayjs', gave the following error.
Argument of type 'TimeIntervalType' is not assignable to parameter of type 'QUnitType'.
Type '"week"' is not assignable to type 'QUnitType'.
Overload 2 of 2, '(value: number, unit?: ManipulateType | undefined): Dayjs', gave the following error.
Argument of type 'TimeIntervalType' is not assignable to parameter of type 'ManipulateType | undefined'.
Type '"quarter"' is not assignable to type 'ManipulateType | undefined'.ts(2769)
```
**Expected behavior**
No typescript errors are expected, but now there are errors.
**Information**
- Day.js Version: 1.11.7
- OS: Mac
- Browser: Chrome
- Time zone: GMT+0530 (India Standard Time)
Contributor guide
Research direction
Start with the quarterOfYear plugin type declarations and the TypeScript example in the linked CodeSandbox. Check how the quarter and week units are represented and accepted by the affected API; done means the example compiles without the reported overload errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100