1) Typescript enum is converted to a regular object type by flowgen
2) Typescript allows you to do import type on an enum type. However, Flow doesn't allow you to import type on a regular object type
3) To allow enum values as a function parameter in Flow, you need to accept $Values<...> as the argument
Bug:
1) Using import type on an enum generated invalid Flow that tried to import an object as a type.
2) Code using enums as types was using the generated object directly as the type, but it needs to use the $Values<...> Flow notation
Fix:
1) The new code now uses import typeof which is valid Flow notation
2) $Values is properly used for enums
Background:
1) Typescript
enum
is converted to a regular object type by flowgen 2) Typescript allows you to doimport type
on an enum type. However, Flow doesn't allow you toimport type
on a regular object type 3) To allow enum values as a function parameter in Flow, you need to accept$Values<...>
as the argumentBug: 1) Using
import type
on an enum generated invalid Flow that tried to import an object as a type. 2) Code using enums as types was using the generated object directly as the type, but it needs to use the$Values<...>
Flow notationFix: 1) The new code now uses
import typeof
which is valid Flow notation 2)$Values
is properly used for enums