proposal-enum icon indicating copy to clipboard operation
proposal-enum copied to clipboard

Compare to Flow runtime?

Open svr93 opened this issue 4 years ago • 1 comments

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

svr93 avatar Nov 15 '21 21:11 svr93

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

Jack-Works avatar Nov 16 '21 04:11 Jack-Works