iamkun / iamkun/dayjs

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

Open
#2,972 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

No repository files or tests are named. Reproduce the TypeScript compilation failure in a React + Vite project using TypeScript 5.5.4, comparing Day.js 1.11.10 with 1.11.19; done when the same project compiles with the newer version without the value.year(...) type mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, vite
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.