Allow StringLiteral to be used as ObjectTypeProperty.key (#7639)

This commit is contained in:
unconfident 2018-03-28 16:20:46 +02:00 committed by Brian Ng
parent 9a26c2b07a
commit 0200e6256a
2 changed files with 2 additions and 2 deletions

View File

@ -1553,7 +1553,7 @@ See also `t.isObjectTypeProperty(node, opts)` and `t.assertObjectTypeProperty(no
Aliases: `Flow`, `UserWhitespacable`
- `key`: `Identifier` (required)
- `key`: `Identifier | StringLiteral` (required)
- `value`: `FlowType` (required)
- `variance`: `Variance` (default: `null`)
- `kind`: `"init" | "get" | "set"` (default: `null`)

View File

@ -291,7 +291,7 @@ defineType("ObjectTypeProperty", {
visitor: ["key", "value", "variance"],
aliases: ["Flow", "UserWhitespacable"],
fields: {
key: validateType("Identifier"),
key: validateType(["Identifier", "StringLiteral"]),
value: validateType("FlowType"),
kind: validate(assertOneOf("init", "get", "set")),
static: validate(assertValueType("boolean")),