question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicate variables in types (Cannot redeclare block-scoped variable 'daysInWeek')

See original GitHub issue

Seems that in master the typings.d.ts has duplicate declared variables for daysInWeek (Line 1197)

`error TS2451: Cannot redeclare block-scoped variable ‘daysInWeek’.

1195 const daysInWeek: number`

https://github.com/date-fns/date-fns/blob/master/typings.d.ts#L1197

duplicate-variable

Was introduced by the commit https://github.com/date-fns/date-fns/commit/6d8e424021f31edacc46b8b55a823fa3b54cc08c

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:7
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
steve3dcommented, Jul 22, 2022

confirmed in version 2.29.0, this also exists.

1reaction
fturmelcommented, Jul 21, 2022

Good one.

@leshakoss @tan75 there is a missing @name jsdoc in the constants file. Pretty sure that’s the root cause here, it’s happened before.

https://github.com/date-fns/date-fns/blob/6d8e424021f31edacc46b8b55a823fa3b54cc08c/src/constants/index.ts#L11-L21

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] Cannot Redeclare Block-Scoped Variable in ...
The “Cannot redeclare block-scoped variable” error occurs if you declare a variable with a name that clashes with one declared in TypeScript ...
Read more >
Cannot redeclare block scoped variable - Stack Overflow
1. How about this - let co_module = require("co"); I faced something similar and this solved the error. · 2. This seems to...
Read more >
Cannot redeclare block-scoped variable in TypeScript
The error "Cannot redeclare block-scoped variable" occurs when we redeclare a variable in the same block or when TypeScript uses global typings, which...
Read more >
[v2.22.0] Typing issue: Cannot redeclare block-scoped ...
Hello @kossnocorp, in the v2.22.0 release, there are duplicates of daysInWeek and minTime in typings.d.ts that create issues with TypeScript.
Read more >
ES2015 Block Scope Variables - Adobe Tech Blog
This means you can refer to a variable before it has been lexically declared, and JavaScript won't complain. It also means that you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found