Flow fails to check Disjoint Unions as object value type
- 主要语言
- Rust
- 星标
- 22.3k
- 派生
- 1.9k
- PR 合并指标
- 30 天内没有已合并 PR
描述
``` javascript
type ASTLiteralNode = {
type: 'Literal',
value: any
};
type ASTThisNode = {
type: 'ThisExpression'
};
class AST {
static Literal = 'Literal';
static ThisExpression = 'ThisExpression';
static constants: { [key: string]: (ASTThisNode | ASTLiteralNode) } = {
'this': { type: AST.ThisExpression },
'null': { type: AST.Literal, value: null },
'true': { type: AST.Literal, value: true },
'false': { type: AST.Literal, value: false }
};
}
```
I got the errors:
```
src/parse.js:242
242: 'null': { type: AST.Literal, value: null },
^^^^^^^^^^^ string. Expected string literal `ThisExpression`, got `Literal` instead
228: type: 'ThisExpression'
^^^^^^^^^^^^^^^^ string literal `ThisExpression`
src/parse.js:243
243: 'true': { type: AST.Literal, value: true },
^^^^^^^^^^^ string. Expected string literal `ThisExpression`, got `Literal` instead
228: type: 'ThisExpression'
^^^^^^^^^^^^^^^^ string literal `ThisExpression`
src/parse.js:244
244: 'false': { type: AST.Literal, value: false }
^^^^^^^^^^^ string. Expected string literal `ThisExpression`, got `Literal` instead
228: type: 'ThisExpression'
^^^^^^^^^^^^^^^^ string literal `ThisExpression`
```
Also, I have enabled `esproposal.class_instance_fields` and `esproposal.class_static_fields` in `.flowconfig`.
贡献指南
评估
这个 Issue 还没有评估数据。