[proposal-object-rest-spread] fix templateLiteral in extractNormalizedKeys (#9628)
Added additional check in extractNormalizedKeys function to handle templates differently than string.
This commit is contained in:
@@ -76,6 +76,8 @@ export default declare((api, opts) => {
|
||||
if (t.isIdentifier(prop.key) && !prop.computed) {
|
||||
// since a key {a: 3} is equivalent to {"a": 3}, use the latter
|
||||
keys.push(t.stringLiteral(prop.key.name));
|
||||
} else if (t.isTemplateLiteral(prop.key)) {
|
||||
keys.push(t.cloneNode(prop.key));
|
||||
} else if (t.isLiteral(prop.key)) {
|
||||
keys.push(t.stringLiteral(String(prop.key.value)));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user