-
Notifications
You must be signed in to change notification settings - Fork 241
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
[BUG] error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided. #1837
Comments
Reading through multiple comments online there are 3 possible solutions to this for your application / library as this was a deliberate change for Application Insights to better support minification and tree-shaking.
|
I'm also investigating to see if there is something I can do like declaring the exports as |
Using So apart from the original suggestions, I don't have any other work-arounds at this point. |
@MSNev - does this mean this will be fixed in an upcoming build? |
No, at this point in time this is a won't fix as we will not be removing the usage of const enums. And because we consume and extend this ourselves internally, one or more of the work arounds above should work. Please feel free to create a minimal repro that shows the issue and I can get someone to research into this a bit deeper for possible solutions / work arounds. I do know that we could stop using the EnumHelpers and manually create the objects, but this is problematic from a validation perspective as it would allow new values to be missed, where the current helpers where designed to break compiling when there was either a missed value or a typo for one of them. I have refrained from tagging this as won't fix, as I expected that at some point a future version of TypeScript may provide an option to more directly address this issue as we are not the only library that has hit this issue. |
@MSNev I have the same issue even when I don't import |
@saranchonkau Can you post your tsconfig.json (or at the relevant settings (module, target, isolatedModules, skipLibCheck, etc) as I would not expect that just importing the ApplicationInsights module (should) cause the reference to be included. And @Karlie-777 if you can please create a repro with the settings so that we can investigate further. |
@MSNev @saranchonkau The error will occur when run |
This Issue will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Encountered 6 errors when updating to v2.8.3 of @microsoft/applicationinsights-web (using tsc v4.6.4). These errors did NOT exist in v2.7.4, but do occur in all v2.8.x releases.
The text was updated successfully, but these errors were encountered: