diff --git a/src/printer.js b/src/printer.js index c5104264..45d8cbe6 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1016,12 +1016,12 @@ function genericPrintNoParens(path, options, print, args) { // Babel 6 Literal split case "StringLiteral": case "Literal": - if (typeof n.value === "number") { - return printNumber(n.raw); - } if (n.regex) { return printRegex(n.regex); } + if (typeof n.value === "number") { + return printNumber(n.raw); + } if (typeof n.value !== "string") { return "" + n.value; } diff --git a/tests/regex/jsfmt.spec.js b/tests/regex/jsfmt.spec.js index 1840e9d3..c426c19c 100644 --- a/tests/regex/jsfmt.spec.js +++ b/tests/regex/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, null, ["babylon"]); +run_spec(__dirname, null, ["babylon", "typescript"]);