dayjs
dayjs copied to clipboard
TypeScript definitions for utc plugin are out of sync with runtime behavior
I hate to pile on as I can see you already have quite a backlog of issues, but as a TypeScript user I have been frustrated by the TypeScript definitions for the utc plugin. For example, this seems to work as expected at runtime:
const date = new Date();
const utc = dayjs.utc([date.year(), date.month() + 1, date.date()])
but results in a TypeScript build error:
TS2345: Argument of type 'number[]' is not assignable to parameter of type 'string | number | Dayjs | Date'. Type 'number[]' is missing the following properties from type 'Dayjs': clone, isValid, year, month, and 24 more
Why am I passing an array? Because I want to construct a utc instance from year, month and day, and I can't get anything else to work properly.
Information
- Day.js Version [e.g. v1.11.7]
- OS: n/a
- Browser [e.g. chrome 62]: n/a
- Time zone: [e.g. GMT-07:00 DST (Pacific Daylight Time)]: n/a