We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

leon • 7 years ago

Did not realize the file is not compile to js. Getting runtime error when defining an enum inside.
Thanks for sharing!

Lukáš Běhal • 7 years ago

Thanks a lot for a feedback! I am glad the article has helped :)

totallygloria • 7 years ago

Thank you very much for this article! I was bashing my head against this and didn't realize where the error was coming in (since vscode helpfully displays imported enum values for you).

Dan King • 5 years ago

Haven't tried this yet, but I suspect a better solution would be to use const enums instead: https://www.typescriptlang....

Since these get compiled out anyway, I suspect they would not be susceptible to the same problem?

Marc Kassay • 7 years ago

Thanks for the article. But I think your TLDR statement is a bold assertion. :) Here is another SO solution: https://stackoverflow.com/a...

Flávio Lisbôa • 8 years ago
Lukáš Běhal • 8 years ago

Thanks Flavio for your suggestion. This is indeed one way how to get around this, however, having to implement interface of the enum seems a bit unnecessary. I've updated the post with the reference to the stackoverflow discussion.