HackerTrans
TopNewTrendsCommentsPastAskShowJobs

GeZe

no profile record

Submissions

TypeScript Enums vs. Flow Enums

medium.com
7 points·by GeZe·il y a 5 ans·8 comments

comments

GeZe
·il y a 5 ans·discuss
FYI, it would not be accurate to say that "The Flow people moved on to ReScript".
GeZe
·il y a 5 ans·discuss
Another example would be the difference between their enum features: https://medium.com/flow-type/typescript-enums-vs-flow-enums-... "TypeScript Enums vs. Flow Enums"
GeZe
·il y a 5 ans·discuss
Flow also supports "discriminated unions" [0], and did so before TypeScript (Flow's announcement in July 2015: https://flow.org/blog/2015/07/03/Disjoint-Unions/, TypeScript's announcement in August 2016: https://devblogs.microsoft.com/typescript/announcing-typescr...), though it doesn't yet support destructuring the "kind" field as was just added to TypeScript.

[0] https://flow.org/try/#0C4TwDgpgBAggxsAlgewHZQLwCgq6gHygG8oBr...
GeZe
·il y a 5 ans·discuss
Here are the docs for exporting/importing enums: https://flow.org/en/docs/enums/using-enums/#toc-exporting-en... - works fine with the new export/import syntax.

Docs for enums compilation/runtime are here: https://flow.org/en/docs/enums/defining-enums/#toc-enums-at-...