Const enums and --isolatedModules
See original GitHub issueI’m trying to use this library in a create-react-app
with TypeScript. When I try to import it, I get the error
(...)/node_modules/@zxing/library/esm5/core/common/CharacterSetECI.d.ts
Type error: Ambient const enums are not allowed when the '--isolatedModules' flag is provided. TS1209
CRA with TypeScript has this flag enabled by default and doesn’t let me turn it off. (To be honest, I don’t really understand what it does. Much less what the difference between enums and const enums is.)
Is there a way around this? I tried to remove all const
s from enum
declarations and all tests still pass.
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Why is `const enum` allowed with `isolatedModules`?
My understanding of --isolatedModules is that it tells the compiler to do extra checking to ensure that separate compilation (such as by using ......
Read more >Cannot access ambient const enums when the ...
Set isolatedModules to true in tsconfig.json. npm run build. Get the following errors ...
Read more >isolatedModules - TSConfig Option - TypeScript
transpileModule API which is used by some build tools. These limitations can cause runtime problems with some TypeScript features like const enum s...
Read more >TypeScript: Don't Export const enums - ncjamieson
Exporting const enums from libraries will break some users. ... TypeScript has an isolatedModules compiler option that performs additional ...
Read more >Cannot access ambient const enums (when using create react ...
I am trying to import an enum 'XRHandJoint', but I get a compilation error 'Cannot access ambient const enums when the '–isolatedModules' ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Works like a charm now. Thank you so much for your help!
Looks like I miserably failed at publishing it, hehe. I will try to publish it ASAP.