-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
How to properly import enums #2298
Comments
I believe this is happening because with esbuild, type annotations have no effect on your compilation as esbuild does not reimplement the TypeScript type checker. Everything in a Some context: TypeScript's list of non-goals includes "[do not] emit different code based on the results of the type system" so type annotations are not supposed to affect the emitted JavaScript code. Babel and esbuild follow this principle. Code like yours (specifically with TypeScript does have a feature that can make doing this a type checking error so that your code won't pass the type checker only to crash at run-time. You have to enable
But that will only make this a type checking error and prevent you from building your code, which won't actually fix your problem. It's not clear to me what you need to do to fix this because you didn't link to the code for the library you're using or to the error message you're getting. I'm guessing that the library you're using makes |
That's the most thorough answer I have ever seen. Thanks! |
Hi
I am having an issue with importing enums using esbuild.
I have an xrm.d.ts file that has an enum that I want to use
But I am not sure how to import it to trigger the esbuild inline function.
This is the resulting build that is failing
Thanks for the help and making this awesome tool.
The text was updated successfully, but these errors were encountered: