I'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 consts from enum declarations and all tests still pass.
Never saw this error before, but we already had const enum problems. What template you'r using with create-react-app and please share the packages versions too.
What do you mean by "template"? I created the project using the --typescript flag.
I'm using "react-scripts": "2.1.1", "typescript": "3.2.1" and "@zxing/library": "0.8.2".
That's what I wanted to know, sorry for my "unfamiliarization" with react terms. Please try upgrading to npm i -S @zxing/[email protected] to see if it solves the problem.
I still get the same error with version 0.8.5.
I removed the const from some enum on v0.9.1, could you give it a try?
Still get the error. Have a look at these two commits:
https://github.com/zxing-js/library/commit/a589300437d9b92e6e6f6b149933f85e6deb7e08
https://github.com/zxing-js/library/commit/f54ef217775b48fc245ffa1eb74993a0050a708c
Those are the consts I removed to get it working.
I see, you removed every const enum. Well, for now that's fine, we can do that.
Thank you so much. Unfortunately, NPM doesn't know version 0.9.2 yet. Do you know what's up with that?
Looks like I miserably failed at publishing it, hehe. I will try to publish it ASAP.
When do you think you'll get around to it?
Now, you can install the latest version and test. :)
Works like a charm now. Thank you so much for your help!
Good to hear that, thanks for the report and patience.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.