feat(typescript): support BigInt (#5546)
This commit is contained in:
6 files changed
+23
-24
No files matched your search
+2
-2
@@ -66,8 +66,8 @@
|
||||
"resolve": "1.5.0",
|
||||
"semver": "5.4.1",
|
||||
"string-width": "2.1.1",
|
||||
"typescript": "3.0.1",
|
||||
"typescript-estree": "1.0.0",
|
||||
"typescript": "3.2.0-rc",
|
||||
"typescript-estree": "6.0.0-rc.1",
|
||||
"unicode-regex": "2.0.0",
|
||||
"unified": "6.1.6",
|
||||
"vnopts": "1.0.2",
|
||||
|
||||
@@ -43,7 +43,7 @@ function tryParseTypeScript(text, jsx) {
|
||||
tokens: true,
|
||||
comment: true,
|
||||
useJSXTextNode: true,
|
||||
ecmaFeatures: { jsx },
|
||||
jsx,
|
||||
// Override logger function with noop,
|
||||
// to avoid unsupported version errors being logged
|
||||
loggerFn: () => {}
|
||||
|
||||
@@ -1573,7 +1573,15 @@ function printPathNoParens(path, options, print, args) {
|
||||
case "NumericLiteral": // Babel 6 Literal split
|
||||
return printNumber(n.extra.raw);
|
||||
case "BigIntLiteral":
|
||||
return concat([printNumber(n.extra.rawValue), "n"]);
|
||||
return concat([
|
||||
printNumber(
|
||||
n.extra
|
||||
? n.extra.rawValue
|
||||
: // TypeScript
|
||||
n.value
|
||||
),
|
||||
"n"
|
||||
]);
|
||||
case "BooleanLiteral": // Babel 6 Literal split
|
||||
case "StringLiteral": // Babel 6 Literal split
|
||||
case "Literal": {
|
||||
@@ -2098,7 +2106,6 @@ function printPathNoParens(path, options, print, args) {
|
||||
);
|
||||
}
|
||||
case "JSXFragment":
|
||||
case "TSJsxFragment":
|
||||
case "JSXElement": {
|
||||
const elem = comments.printComments(
|
||||
path,
|
||||
@@ -2204,14 +2211,11 @@ function printPathNoParens(path, options, print, args) {
|
||||
case "JSXClosingElement":
|
||||
return concat(["</", path.call(print, "name"), ">"]);
|
||||
case "JSXOpeningFragment":
|
||||
case "JSXClosingFragment":
|
||||
case "TSJsxOpeningFragment":
|
||||
case "TSJsxClosingFragment": {
|
||||
case "JSXClosingFragment": {
|
||||
const hasComment = n.comments && n.comments.length;
|
||||
const hasOwnLineComment =
|
||||
hasComment && !n.comments.every(handleComments.isBlockComment);
|
||||
const isOpeningFragment =
|
||||
n.type === "JSXOpeningFragment" || n.type === "TSJsxOpeningFragment";
|
||||
const isOpeningFragment = n.type === "JSXOpeningFragment";
|
||||
return concat([
|
||||
isOpeningFragment ? "<" : "</",
|
||||
indent(
|
||||
@@ -4961,11 +4965,7 @@ function isCallOrOptionalCallExpression(node) {
|
||||
}
|
||||
|
||||
function isJSXNode(node) {
|
||||
return (
|
||||
node.type === "JSXElement" ||
|
||||
node.type === "JSXFragment" ||
|
||||
node.type === "TSJsxFragment"
|
||||
);
|
||||
return node.type === "JSXElement" || node.type === "JSXFragment";
|
||||
}
|
||||
|
||||
function isEmptyJSXElement(node) {
|
||||
@@ -5507,7 +5507,6 @@ function maybeWrapJSXElementInParens(path, elem) {
|
||||
JSXElement: true,
|
||||
JSXExpressionContainer: true,
|
||||
JSXFragment: true,
|
||||
TSJsxFragment: true,
|
||||
ExpressionStatement: true,
|
||||
CallExpression: true,
|
||||
OptionalCallExpression: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
exports[`literal.js 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babylon"]
|
||||
parsers: ["babylon", "typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
|
||||
@@ -1 +1 @@
|
||||
run_spec(__dirname, ["babylon"]);
|
||||
run_spec(__dirname, ["babylon", "typescript"]);
|
||||
@@ -5698,16 +5698,16 @@ typedarray@^0.0.6:
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
|
||||
typescript-estree@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/typescript-estree/-/typescript-estree-1.0.0.tgz#6266f31108d2f12594cb996d0e16d938e3cb83cd"
|
||||
typescript-estree@6.0.0-rc.1:
|
||||
version "6.0.0-rc.1"
|
||||
resolved "https://registry.yarnpkg.com/typescript-estree/-/typescript-estree-6.0.0-rc.1.tgz#2bc3d89d206ebdfa04cdebd9acf03aed9fff8860"
|
||||
dependencies:
|
||||
lodash.unescape "4.0.1"
|
||||
semver "5.5.0"
|
||||
|
||||
typescript@3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb"
|
||||
typescript@3.2.0-rc:
|
||||
version "3.2.0-rc"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.0-rc.tgz#7c3816f1c761b096f4f1712382e872f4da8f263e"
|
||||
|
||||
ua-parser-js@^0.7.9:
|
||||
version "0.7.17"
|
||||
|
||||
Reference in new issue
Block a user