literal to stringLiteral - fixes T6667
This commit is contained in:
parent
efa9a1abf2
commit
3a05513e31
@ -288,7 +288,7 @@ export function valueToNode(value: any): Object {
|
||||
if (t.isValidIdentifier(key)) {
|
||||
nodeKey = t.identifier(key);
|
||||
} else {
|
||||
nodeKey = t.literal(key);
|
||||
nodeKey = t.stringLiteral(key);
|
||||
}
|
||||
props.push(t.objectProperty(nodeKey, t.valueToNode(value[key])));
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ defineType("ObjectMethod", {
|
||||
},
|
||||
key: {
|
||||
validate(node, key, val) {
|
||||
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "Literal"];
|
||||
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral"];
|
||||
assertNodeType(...expectedTypes)(node, key, val);
|
||||
}
|
||||
},
|
||||
@ -510,7 +510,7 @@ defineType("ObjectProperty", {
|
||||
},
|
||||
key: {
|
||||
validate(node, key, val) {
|
||||
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "Literal"];
|
||||
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral"];
|
||||
assertNodeType(...expectedTypes)(node, key, val);
|
||||
}
|
||||
},
|
||||
|
||||
@ -254,7 +254,7 @@ defineType("ClassMethod", {
|
||||
},
|
||||
key: {
|
||||
validate(node, key, val) {
|
||||
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "Literal"];
|
||||
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral"];
|
||||
assertNodeType(...expectedTypes)(node, key, val);
|
||||
}
|
||||
},
|
||||
|
||||
@ -41,7 +41,7 @@ defineType("JSXElement", {
|
||||
children: {
|
||||
validate: chain(
|
||||
assertValueType("array"),
|
||||
assertEach(assertNodeType("Literal", "JSXExpressionContainer", "JSXElement"))
|
||||
assertEach(assertNodeType("StringLiteral", "JSXExpressionContainer", "JSXElement"))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user