oli*_*ver 6 javascript types flowtype
我正在使用flow来注释我的代码中的类型.
type Bar = 'One' | 'Two';
function foo(b: Bar) : boolean {
return b === 'Three';
}
Run Code Online (Sandbox Code Playgroud)
是否有任何方法可以教导flow报告警告或错误以与不匹配类型进行比较(string在我的情况下)?
编辑:所以似乎无法使用枚举.但是,由于这实际上是我遇到的错误,我想表达这一点,以便流程将帮助我标记这种情况.
有什么想法吗?