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
rxjs 6.4.0 does not compile with Create React App (@babel/plugin-transform-typescript) due to exporting a const enum #4555
Comments
Closing as dupe of #4538 fyi we were using string based literal and moved to enum, while we may go back to non const enum. |
I was asked to open a new issue #4538 (comment) But it really is the same root cause in the end. |
@BrianMitchL Your including the In any case, I agree that it would be better to revert the const enum change and use a union of string-literal types. |
I think this is dupe as both of then are caused by not supporting const enum, while path it causes are different: it is true babel doesn't support const enum so regardless of isolatedmodules this'll occur as soon as we use const enum though. |
Which means we can't use const enum. |
As I understand the CRA compile process, |
Yeah. You are completely correct. The use of the term 'ambient' in the error message confused me - as the term has a different meaning for It's clear to me now that the problem stems from the fact that when transpiling a single file, it's not possible to know which literal value should be used to replace a reference to a const enum. I'll add a script that runs a transpilation (with no output and with |
Bug Report
Current Behavior
In RxJS 6.4.0, the
NotificationKind
const enum was used:rxjs/src/internal/Notification.ts
Line 7 in 6c4f57b
Unfortunately, babel does not support const enums, so any application that is compiled with it will not compile. This is the TypeScript compiler used in create-react-app apps. The errors presents itself when the TypeScript
skipLibCheck
flag is set to false.Reproduction
https://github.com/BrianMitchL/rxjs-cra-compile-error
The 6.4.0 branch errors when running
npm run start
when the 6.3.3 branch works.
Expected behavior
I would expect the application to compile with RxJS 6.4.0 when using the babel compiler.
Environment
typescript@3.3.3
react-scripts@2.1.3
Possible Solution
Removing the
const
from the enum. From the babel docs:Otherwise, this might be a good place to use a union string type. Instead of
the following would be used
The text was updated successfully, but these errors were encountered: