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

[v2.22.0] Typing issue: Cannot redeclare block-scoped variable daysInWeek/minTime #2491

Closed
Rogdham opened this issue May 28, 2021 · 14 comments
Closed

Comments

@Rogdham
Copy link

Rogdham commented May 28, 2021

Hello @kossnocorp, in the v2.22.0 release, there are duplicates of daysInWeek and minTime in typings.d.ts that create issues with TypeScript.

Unfold for error messages

node_modules/date-fns/typings.d.ts:1131:9 - error TS2451: Cannot redeclare block-scoped variable 'daysInWeek'.

1131   const daysInWeek: number
             ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:1133:9 - error TS2451: Cannot redeclare block-scoped variable 'daysInWeek'.

1133   const daysInWeek: number
             ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:1141:9 - error TS2451: Cannot redeclare block-scoped variable 'minTime'.

1141   const minTime: number
             ~~~~~~~

node_modules/date-fns/typings.d.ts:1143:9 - error TS2451: Cannot redeclare block-scoped variable 'minTime'.

1143   const minTime: number
             ~~~~~~~

node_modules/date-fns/typings.d.ts:5598:9 - error TS2451: Cannot redeclare block-scoped variable 'daysInWeek'.

5598   const daysInWeek: number
             ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:5600:9 - error TS2451: Cannot redeclare block-scoped variable 'daysInWeek'.

5600   const daysInWeek: number
             ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:5608:9 - error TS2451: Cannot redeclare block-scoped variable 'minTime'.

5608   const minTime: number
             ~~~~~~~

node_modules/date-fns/typings.d.ts:5610:9 - error TS2451: Cannot redeclare block-scoped variable 'minTime'.

5610   const minTime: number
             ~~~~~~~

node_modules/date-fns/typings.d.ts:10231:9 - error TS2451: Cannot redeclare block-scoped variable 'daysInWeek'.

10231   const daysInWeek: number
              ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:10233:9 - error TS2451: Cannot redeclare block-scoped variable 'daysInWeek'.

10233   const daysInWeek: number
              ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:10241:9 - error TS2451: Cannot redeclare block-scoped variable 'minTime'.

10241   const minTime: number
              ~~~~~~~

node_modules/date-fns/typings.d.ts:10243:9 - error TS2451: Cannot redeclare block-scoped variable 'minTime'.

10243   const minTime: number
              ~~~~~~~

node_modules/date-fns/typings.d.ts:14698:9 - error TS2451: Cannot redeclare block-scoped variable 'daysInWeek'.

14698   const daysInWeek: number
              ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:14700:9 - error TS2451: Cannot redeclare block-scoped variable 'daysInWeek'.

14700   const daysInWeek: number
              ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:14708:9 - error TS2451: Cannot redeclare block-scoped variable 'minTime'.

14708   const minTime: number
              ~~~~~~~

node_modules/date-fns/typings.d.ts:14710:9 - error TS2451: Cannot redeclare block-scoped variable 'minTime'.

14710   const minTime: number
              ~~~~~~~

node_modules/date-fns/typings.d.ts:22013:3 - error TS2300: Duplicate identifier 'daysInWeek'.

22013   daysInWeek: number
        ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:22015:3 - error TS2300: Duplicate identifier 'daysInWeek'.

22015   daysInWeek: number
        ~~~~~~~~~~

node_modules/date-fns/typings.d.ts:22023:3 - error TS2300: Duplicate identifier 'minTime'.

22023   minTime: number
        ~~~~~~~

node_modules/date-fns/typings.d.ts:22025:3 - error TS2300: Duplicate identifier 'minTime'.

22025   minTime: number
        ~~~~~~~


FAQ

This issue is getting some traction, people are subscribing to it, so we would all appreciate if you could reduce the noise and comment only if you bring something new to the discussion 🙏

I'm having the same issue

  • please react with the 👍 emoji on this message instead of posting a message to say that
  • also the errors and impacted files are listed above (if you unfold when mentionned)

How to fix the issue for now?

  • you can revert to previous version 2.21.3 (or maybe earlier, some user reported the issue was present in 2.21.3)
  • you can use the following workaround: set skipLibCheck to true in tsconfig.json (section compilerOptions).

I want to fix the issue by creating a PR

Please coordinate by writing below! Note that the typings.d.ts file is generated automatically by scripts/build/typings.js, so you probably need to look into that and make the changes there.

People are looking to fix that issue now 🤞

🎉 bug fixed in v2.22.1 🎉

@EduardoMM17
Copy link

Also having this issue

@swftvsn
Copy link

swftvsn commented May 28, 2021

Just got this too.

@Gyufei
Copy link

Gyufei commented May 28, 2021

having this issue too,
set skipLibCheck to true in tsconfig.json compilerOptions solved my problem

@lpellegr
Copy link

@kossnocorp kindly ping as many people updating date-fns will experience errors.

@Rogdham
Copy link
Author

Rogdham commented May 28, 2021

@douweknook The typings.d.ts file is generated automatically by scripts/build/typings.js, so you probably need to look into that and make the changes there.

I've edited the first message to mention that

@tan75
Copy link
Contributor

tan75 commented May 28, 2021

hi everyone,
we are looking into this issue now.

@vibhakara-acharya
Copy link

We are facing same issue due to which our prod pipeline is failing. As i looked into it, this caused by recent commit 3hrs ago typings.d.ts

image

Please look into it.

@AniaMakes
Copy link

Just to add that we're seeing this issue when using v2.21.3

@Rogdham
Copy link
Author

Rogdham commented May 28, 2021

Just to add that we're seeing this issue when using v2.21.3

@AniaMakes good to know, although it seems fine on my side with v2.21.3; I'm updating my first message regardless

@blazmrak
Copy link

blazmrak commented May 28, 2021

I've deployed my app around 1h before 2.22.0 and deployment went through, then after 2.22.0 was released the build failed. When I lowered the version back to 2.21.3 the build went through normally again.

@kossnocorp
Copy link
Member

@Rogdham, thank you so much for a promptly and carefully crafted issue. I'm already working on a fix and hope to release it really soon.

@fturmel
Copy link
Member

fturmel commented May 28, 2021

@kossnocorp see #2494, I think that should take care of the problem. That constants file needs explicit @name jsdocs, Babel is mangling the output and jsdocs can't keep track of what variable is associated with which jsdoc block.

@kossnocorp
Copy link
Member

Fixed and released in v2.22.1

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