Fix literal type annotation argument number (#7706)

Added the value argument to the visitors of flow literal type
annotations.
Literal type annotations need a value since they work very much like
primitive literals in normal JavaScript.

Fixes #7697
This commit is contained in:
Hendrik Niemann 2018-04-10 15:38:20 +02:00 committed by Henry Zhu
parent 5b1332457c
commit fdd0789936
2 changed files with 9 additions and 6 deletions

View File

@ -183,14 +183,14 @@ Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
### booleanLiteralTypeAnnotation
```javascript
t.booleanLiteralTypeAnnotation()
t.booleanLiteralTypeAnnotation(value)
```
See also `t.isBooleanLiteralTypeAnnotation(node, opts)` and `t.assertBooleanLiteralTypeAnnotation(node, opts)`.
Aliases: `Flow`, `FlowType`
- `value`: `boolean` (default: `null`)
- `value`: `boolean` (required)
---
@ -1408,14 +1408,14 @@ Aliases: `Flow`, `FlowType`
### numberLiteralTypeAnnotation
```javascript
t.numberLiteralTypeAnnotation()
t.numberLiteralTypeAnnotation(value)
```
See also `t.isNumberLiteralTypeAnnotation(node, opts)` and `t.assertNumberLiteralTypeAnnotation(node, opts)`.
Aliases: `Flow`, `FlowType`
- `value`: `number` (default: `null`)
- `value`: `number` (required)
---
@ -1776,14 +1776,14 @@ Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
### stringLiteralTypeAnnotation
```javascript
t.stringLiteralTypeAnnotation()
t.stringLiteralTypeAnnotation(value)
```
See also `t.isStringLiteralTypeAnnotation(node, opts)` and `t.assertStringLiteralTypeAnnotation(node, opts)`.
Aliases: `Flow`, `FlowType`
- `value`: `string` (default: `null`)
- `value`: `string` (required)
---

View File

@ -26,6 +26,7 @@ defineType("BooleanTypeAnnotation", {
});
defineType("BooleanLiteralTypeAnnotation", {
builder: ["value"],
aliases: ["Flow", "FlowType"],
fields: {
value: validate(assertValueType("boolean")),
@ -239,6 +240,7 @@ defineType("NullableTypeAnnotation", {
});
defineType("NumberLiteralTypeAnnotation", {
builder: ["value"],
aliases: ["Flow", "FlowType"],
fields: {
value: validate(assertValueType("number")),
@ -329,6 +331,7 @@ defineType("QualifiedTypeIdentifier", {
});
defineType("StringLiteralTypeAnnotation", {
builder: ["value"],
aliases: ["Flow", "FlowType"],
fields: {
value: validate(assertValueType("string")),