Flow opaque type 6.x backport (#6081)
* Flow opaque type backport * Add tests for strip types, comments, and babel-generator * Fix failing tests, run scripts * Bump babylon to 6.18.0
This commit is contained in:
@@ -46,7 +46,7 @@ See also `t.isArrayPattern(node, opts)` and `t.assertArrayPattern(node, opts)`.
|
||||
|
||||
Aliases: `Pattern`, `LVal`
|
||||
|
||||
- `elements`: `Array<Expression>` (required)
|
||||
- `elements`: `Array<Identifier | Pattern | RestElement>` (required)
|
||||
- `typeAnnotation` (required)
|
||||
- `decorators`: `Array<Decorator>` (default: `null`)
|
||||
|
||||
@@ -463,6 +463,21 @@ Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
||||
|
||||
---
|
||||
|
||||
### declareOpaqueType
|
||||
```javascript
|
||||
t.declareOpaqueType(id, typeParameters, supertype)
|
||||
```
|
||||
|
||||
See also `t.isDeclareOpaqueType(node, opts)` and `t.assertDeclareOpaqueType(node, opts)`.
|
||||
|
||||
Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
||||
|
||||
- `id` (required)
|
||||
- `typeParameters` (required)
|
||||
- `supertype` (required)
|
||||
|
||||
---
|
||||
|
||||
### declareTypeAlias
|
||||
```javascript
|
||||
t.declareTypeAlias(id, typeParameters, right)
|
||||
@@ -1368,7 +1383,7 @@ See also `t.isObjectProperty(node, opts)` and `t.assertObjectProperty(node, opts
|
||||
Aliases: `UserWhitespacable`, `Property`, `ObjectMember`
|
||||
|
||||
- `key`if computed then `Expression` else `Identifier | Literal` (required)
|
||||
- `value`: `Expression` (required)
|
||||
- `value`: `Expression | Pattern | RestElement` (required)
|
||||
- `computed`: `boolean` (default: `false`)
|
||||
- `shorthand`: `boolean` (default: `false`)
|
||||
- `decorators`: `Array<Decorator>` (default: `null`)
|
||||
@@ -1432,6 +1447,35 @@ Aliases: `Flow`, `UserWhitespacable`
|
||||
|
||||
---
|
||||
|
||||
### objectTypeSpreadProperty
|
||||
```javascript
|
||||
t.objectTypeSpreadProperty(argument)
|
||||
```
|
||||
|
||||
See also `t.isObjectTypeSpreadProperty(node, opts)` and `t.assertObjectTypeSpreadProperty(node, opts)`.
|
||||
|
||||
Aliases: `Flow`, `UserWhitespacable`
|
||||
|
||||
- `argument` (required)
|
||||
|
||||
---
|
||||
|
||||
### opaqueType
|
||||
```javascript
|
||||
t.opaqueType(id, typeParameters, impltype, supertype)
|
||||
```
|
||||
|
||||
See also `t.isOpaqueType(node, opts)` and `t.assertOpaqueType(node, opts)`.
|
||||
|
||||
Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
||||
|
||||
- `id` (required)
|
||||
- `typeParameters` (required)
|
||||
- `impltype` (required)
|
||||
- `supertype` (required)
|
||||
|
||||
---
|
||||
|
||||
### parenthesizedExpression
|
||||
```javascript
|
||||
t.parenthesizedExpression(expression)
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-generator": "^6.22.0",
|
||||
"babylon": "^6.17.2"
|
||||
"babylon": "^6.18.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,14 @@ defineType("DeclareTypeAlias", {
|
||||
}
|
||||
});
|
||||
|
||||
defineType("DeclareOpaqueType", {
|
||||
visitor: ["id", "typeParameters", "supertype"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
// todo
|
||||
}
|
||||
});
|
||||
|
||||
defineType("DeclareVariable", {
|
||||
visitor: ["id"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
@@ -111,6 +119,14 @@ defineType("DeclareVariable", {
|
||||
}
|
||||
});
|
||||
|
||||
defineType("DeclareExportDeclaration", {
|
||||
visitor: ["declaration", "specifiers", "source"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
// todo
|
||||
},
|
||||
});
|
||||
|
||||
defineType("ExistentialTypeParam", {
|
||||
aliases: ["Flow"]
|
||||
});
|
||||
@@ -236,6 +252,14 @@ defineType("TypeAlias", {
|
||||
}
|
||||
});
|
||||
|
||||
defineType("OpaqueType", {
|
||||
visitor: ["id", "typeParameters", "impltype", "supertype"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
// todo
|
||||
}
|
||||
});
|
||||
|
||||
defineType("TypeAnnotation", {
|
||||
visitor: ["typeAnnotation"],
|
||||
aliases: ["Flow"],
|
||||
|
||||
@@ -70,6 +70,7 @@ getBindingIdentifiers.keys = {
|
||||
DeclareVariable: ["id"],
|
||||
InterfaceDeclaration: ["id"],
|
||||
TypeAlias: ["id"],
|
||||
OpaqueType: ["id"],
|
||||
|
||||
CatchClause: ["param"],
|
||||
LabeledStatement: ["label"],
|
||||
|
||||
Reference in New Issue
Block a user