type EnumType = 't1' | 't2';
function f(b: EnumType) {
}
f('t3');
I don't receive a warning using Flowtype. Using it with this plugin, it is transformed into a function that simply checks that the given variable b is of a type of one of the literals in the EnumType. I think it should not just check for the type when the type alias is using literals but also compare it to the given values.
Based off of reading some of the Flowtype issues, unions are the only way of defining enums currently.
With the following code:
I don't receive a warning using Flowtype. Using it with this plugin, it is transformed into a function that simply checks that the given variable
b
is of a type of one of the literals in theEnumType
. I think it should not just check for the type when the type alias is using literals but also compare it to the given values.Based off of reading some of the Flowtype issues, unions are the only way of defining enums currently.