diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index 46597cb1f6..8e9644134a 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -278,11 +278,11 @@ export function buildMatchMemberExpression(match:string, allowPartial?: boolean) if (t.isIdentifier(node)) { // this part doesn't match if (parts[i] !== node.name) return false; - } else if (t.isLiteral(node)) { + } else if (t.isStringLiteral(node)) { // this part doesn't match if (parts[i] !== node.value) return false; } else if (t.isMemberExpression(node)) { - if (node.computed && !t.isLiteral(node.property)) { + if (node.computed && !t.isStringLiteral(node.property)) { // we can't deal with this return false; } else { diff --git a/packages/babel-types/src/react.js b/packages/babel-types/src/react.js index 9b0996f530..a7a739de0b 100644 --- a/packages/babel-types/src/react.js +++ b/packages/babel-types/src/react.js @@ -56,7 +56,7 @@ function cleanJSXElementLiteralChild(child, args) { } } - if (str) args.push(t.literal(str)); + if (str) args.push(t.stringLiteral(str)); } /** @@ -69,7 +69,7 @@ export function buildChildren(node) { for (var i = 0; i < node.children.length; i++) { var child = node.children[i]; - if (t.isLiteral(child) && typeof child.value === "string") { + if (t.isStringLiteral(child)) { cleanJSXElementLiteralChild(child, elems); continue; }