typescript-vs-flowtype
typescript-vs-flowtype copied to clipboard
Typescript Enums
Added a typescript unique feature: Enums
Closes https://github.com/niieani/typescript-vs-flowtype/issues/57
@niieani I'm not sure, "const enums" should be mentions, because time after time the TS team against using it in every issue arise about them
There is missing about enums:
- Enums are the only nominal types in TS
- About
numberenums: They are always mixed withstrings (unlike onlystringenums)
enum E { a, b } = { a: 0, b: 1, 0: "a", 1: "b" };
Agree const enum are not something worth covering. Its a bundle size optimization. Number enums are not always mixes with string values, you can get the enum key by its value (and vice versa).
I'll add the info about the additional emitted code. With that said, typescript emits more code than just enums, depends on the ES version you target. It might (Im not sure) be the only additional code if you target es7+.