Fix TypeScript regex (#1527)
Turns out n.value is NaN for regexes in typescript, go figure. Just moving the two if statements is working to fix the issue. Fixes #1526master
parent
b9a7549e47
commit
c8984f392a
|
@ -1016,12 +1016,12 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
// Babel 6 Literal split
|
// Babel 6 Literal split
|
||||||
case "StringLiteral":
|
case "StringLiteral":
|
||||||
case "Literal":
|
case "Literal":
|
||||||
if (typeof n.value === "number") {
|
|
||||||
return printNumber(n.raw);
|
|
||||||
}
|
|
||||||
if (n.regex) {
|
if (n.regex) {
|
||||||
return printRegex(n.regex);
|
return printRegex(n.regex);
|
||||||
}
|
}
|
||||||
|
if (typeof n.value === "number") {
|
||||||
|
return printNumber(n.raw);
|
||||||
|
}
|
||||||
if (typeof n.value !== "string") {
|
if (typeof n.value !== "string") {
|
||||||
return "" + n.value;
|
return "" + n.value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
run_spec(__dirname, null, ["babylon"]);
|
run_spec(__dirname, null, ["babylon", "typescript"]);
|
||||||
|
|
Loading…
Reference in New Issue