Skip to content

Regression in TypeScript definitions after upgrading from Day.js 1.11.10 → 1.11.19 (value.year(...) type mismatch) #2972

@koushik-a

Description

@koushik-a

After upgrading Day.js from 1.11.10 to 1.11.19, our project started failing to compile due to a TypeScript type error involving the year() method. This issue did not occur in previous versions and appears to be a regression or unintended breaking change introduced in a patch release.

Error message:
The types returned by 'value.year(...)' are incompatible between these types.
Type 'number' is not assignable to type 'Dayjs'.

Versions
React + Vite project

Working dayJS version: 1.11.10

Failing dayJS version: 1.11.19

Typescript version: 5.5.4

React version: 18.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions