Jack-Works / proposal-enum

ADT enum proposal for ECMAScript
MIT License
89 stars 1 forks source link

Compare to Flow runtime? #23

Open svr93 opened 2 years ago

svr93 commented 2 years ago

Flow has different methods helpful for enum usage: https://flow.org/en/docs/enums/using-enums/#toc-methods 1) cast 2) isValid

It will be wonderful to include some helpers with strict type safety in TS:

v = SomeEnum.cast(raw) // v type inference: SomeEnum | null
Jack-Works commented 2 years ago

Yes, it's a useful feature but I'm worried about how ADT enums will work with those mehods.