iamkun / iamkun/dayjs

[2.0] TypeScript definitions are incorrect

Open
#2,733 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

**Describe the bug**
In almost all cases, the TypeScript declarations are incorrect. The mistake made is that you should actually have 2 declarations files per dual-emitted-module. E.g. `index.d.ts` and `index.d.mts`

You can check for yourself here https://arethetypeswrong.github.io/?p=dayjs%402.0.0-alpha.4

Simple reproduction: https://stackblitz.com/edit/vitejs-vite-n5nsvh?file=src%2Fmain.ts

**Expected behavior**
The TypeScript definitions are correct.

**Information**
- Day.js Version: 2.0.0-alpha.4

Contributor guide

Open the contributing guide

Research direction

Start with the arethetypeswrong.org report and the StackBlitz reproduction at src/main.ts to confirm the incorrect declaration behavior for Day.js 2.0.0-alpha.4. Trace the package's published TypeScript declarations and module exports, then verify that dual-emitted modules provide the expected declaration files and that the reproduction type-checks correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.