loading...

re: Using enums with string values in TypeScript? Consider string literals instead! VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I would add that a benefit of string literal types is that they don't emit anything. As opposed to a simple enum like this: enum BannerType { ...
 

You can use const enum if you don't like that behavior.

 

Yes, but I don't think they work when using the --isolatedModules compiler option.

I mean they work but only within a module. You can't export a const enum.

If you have types imports and exports, most of the type checking won't work when you use isolated modules.

Code of Conduct Report abuse