Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument of type "quarter" | "isoWeek" is not assignable to parameter of type 'DurationUnitType' #2557

Open
johanrd opened this issue Jan 17, 2024 · 1 comment

Comments

@johanrd
Copy link

johanrd commented Jan 17, 2024

Describe the bug
Typescript complains that "quarter" and "isoWeek" are not assignable to parameter of type DurationUnitType when using the isoWeek and quarterOfYear in combination with duration:

import dayjs from 'dayjs'
import isoWeek from 'dayjs/plugin/isoWeek'
import duration from 'dayjs/plugin/duration'
import quarterOfYear from 'dayjs/plugin/quarterOfYear'

dayjs.extend(duration)
dayjs.extend(quarterOfYear)
dayjs.extend(isoWeek)

dayjs.duration(1, 'quarter') // Argument of type '"quarter"' is not assignable to parameter of type 'DurationUnitType | undefined' ts 2345
dayjs.duration(1, 'isoWeek') // Argument of type '"isoWeek"' is not assignable to parameter of type 'DurationUnitType | undefined' ts 2345

Expected behavior
Plugin isoWeek and quarterOfYear to extend the expected input types of dayjs.duration()

Information

  • Day.js Version v1.11.10
  • Typescript v5.3.3

Possibly related to #1354, @zardoy?

@zardoy
Copy link
Contributor

zardoy commented Jan 18, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants