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.

TS2451: Cannot redeclare block-scoped variable

See original GitHub issue

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/angular

SDK Version

7.16.0

Framework Version

Angular 13.3.11 & Ionic 6.3.2

Link to Sentry event

No response

Steps to Reproduce

Node.js v16.10.x

Typescript 4.5.x

Currently we are using the following versions of Sentry package: “@sentry/angular”: “^6.19.7”, “@sentry/capacitor”: “^0.6.1”, “@sentry/tracing”: “^6.19.7”

After trying to bump all packages to latest i.e.: “@sentry/angular”: “^7.16.0”, “@sentry/capacitor”: “^0.10.1”, “@sentry/tracing”: “^7.16.0”

Expected Result

No error

Actual Result

I receive the following error:

Error: node_modules/@sentry/types/types/globals.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable '__DEBUG_BUILD__'.

2     const __DEBUG_BUILD__: boolean;
            ~~~~~~~~~~~~~~~

  node_modules/@sentry/tracing/node_modules/@sentry/types/types/globals.d.ts:2:11
    2     const __DEBUG_BUILD__: boolean;
                ~~~~~~~~~~~~~~~
    '__DEBUG_BUILD__' was also declared here.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
lucas-zimermancommented, Oct 25, 2022

To fix this you must use a fixed sibling version of angular and tracing

"@sentry/angular": "7.13.0",
"@sentry/capacitor": "0.10.1",
"@sentry/tracing": "7.13.0"

Additionally, at the moment the SDK is compatible with version 7.13.0.

Hopefully this situation will get clearer on the next versions of Sentry Capacitor

1reaction
matthew2564commented, Oct 27, 2022

Just to let you know, fixing the versions as specified above does work - thank you @lucas-zimerman.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot redeclare block scoped variable - Stack Overflow
It happens when variable co is already defined in the scope (maybe window/global object has it) and you ...
Read more >
[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 >
TypeScript and the Error: Cannot Redeclare Block Scoped ...
Hi, Devs! Who are getting start in Typescript could face this error: "Cannot Redeclare Block Scoped Variable Name" and it means a concept ......
Read more >
SOLVED TypeScript Cannot Redeclare Block Scoped ...
Solution for an issue that says cannot redeclare block scoped variable name in TypeScript.
Read more >
Cannot redeclare block-scoped variable? How to resolve
Typescript is moduler and each module has it's own block. So, basically if you could somehow enclose the variable which is declared as...
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