The TypeScript comment is wrong, the author needs to use a const enum:
https://www.typescriptlang.org/docs/handbook/enums.html#cons...
Then it generates code that's better than Flow. It's not as aggressive as Reason for sure, but it's still pretty good.
https://www.typescriptlang.org/play/#src=const%20enum%20Scre...