summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/typescript.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/typescript.js')
-rw-r--r--tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/typescript.js124
1 files changed, 62 insertions, 62 deletions
diff --git a/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/typescript.js b/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/typescript.js
index bf3f78faa1..c5b71f3bdc 100644
--- a/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/typescript.js
+++ b/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/typescript.js
@@ -73,21 +73,21 @@ exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
exports.tsPrintTypeLiteralOrInterfaceBody = tsPrintTypeLiteralOrInterfaceBody;
function TSTypeAnnotation(node) {
- this.token(":");
+ this.tokenChar(58);
this.space();
- if (node.optional) this.token("?");
+ if (node.optional) this.tokenChar(63);
this.print(node.typeAnnotation, node);
}
function TSTypeParameterInstantiation(node, parent) {
- this.token("<");
+ this.tokenChar(60);
this.printList(node.params, node, {});
if (parent.type === "ArrowFunctionExpression" && node.params.length === 1) {
- this.token(",");
+ this.tokenChar(44);
}
- this.token(">");
+ this.tokenChar(62);
}
function TSTypeParameter(node) {
@@ -112,7 +112,7 @@ function TSTypeParameter(node) {
if (node.default) {
this.space();
- this.token("=");
+ this.tokenChar(61);
this.space();
this.print(node.default, node);
}
@@ -140,31 +140,31 @@ function TSDeclareFunction(node) {
this._functionHead(node);
- this.token(";");
+ this.tokenChar(59);
}
function TSDeclareMethod(node) {
this._classMethodHead(node);
- this.token(";");
+ this.tokenChar(59);
}
function TSQualifiedName(node) {
this.print(node.left, node);
- this.token(".");
+ this.tokenChar(46);
this.print(node.right, node);
}
function TSCallSignatureDeclaration(node) {
this.tsPrintSignatureDeclarationBase(node);
- this.token(";");
+ this.tokenChar(59);
}
function TSConstructSignatureDeclaration(node) {
this.word("new");
this.space();
this.tsPrintSignatureDeclarationBase(node);
- this.token(";");
+ this.tokenChar(59);
}
function TSPropertySignature(node) {
@@ -183,27 +183,27 @@ function TSPropertySignature(node) {
if (initializer) {
this.space();
- this.token("=");
+ this.tokenChar(61);
this.space();
this.print(initializer, node);
}
- this.token(";");
+ this.tokenChar(59);
}
function tsPrintPropertyOrMethodName(node) {
if (node.computed) {
- this.token("[");
+ this.tokenChar(91);
}
this.print(node.key, node);
if (node.computed) {
- this.token("]");
+ this.tokenChar(93);
}
if (node.optional) {
- this.token("?");
+ this.tokenChar(63);
}
}
@@ -219,7 +219,7 @@ function TSMethodSignature(node) {
this.tsPrintPropertyOrMethodName(node);
this.tsPrintSignatureDeclarationBase(node);
- this.token(";");
+ this.tokenChar(59);
}
function TSIndexSignature(node) {
@@ -238,13 +238,13 @@ function TSIndexSignature(node) {
this.space();
}
- this.token("[");
+ this.tokenChar(91);
this._parameters(node.parameters, node);
- this.token("]");
+ this.tokenChar(93);
this.print(node.typeAnnotation, node);
- this.token(";");
+ this.tokenChar(59);
}
function TSAnyKeyword() {
@@ -324,11 +324,11 @@ function tsPrintFunctionOrConstructorType(node) {
} = node;
const parameters = node.parameters;
this.print(typeParameters, node);
- this.token("(");
+ this.tokenChar(40);
this._parameters(parameters, node);
- this.token(")");
+ this.tokenChar(41);
this.space();
this.token("=>");
this.space();
@@ -337,8 +337,8 @@ function tsPrintFunctionOrConstructorType(node) {
}
function TSTypeReference(node) {
- this.print(node.typeName, node);
- this.print(node.typeParameters, node);
+ this.print(node.typeName, node, true);
+ this.print(node.typeParameters, node, true);
}
function TSTypePredicate(node) {
@@ -395,19 +395,19 @@ function tsPrintBraced(printer, members, node) {
}
function TSArrayType(node) {
- this.print(node.elementType, node);
+ this.print(node.elementType, node, true);
this.token("[]");
}
function TSTupleType(node) {
- this.token("[");
+ this.tokenChar(91);
this.printList(node.elementTypes, node);
- this.token("]");
+ this.tokenChar(93);
}
function TSOptionalType(node) {
this.print(node.typeAnnotation, node);
- this.token("?");
+ this.tokenChar(63);
}
function TSRestType(node) {
@@ -417,8 +417,8 @@ function TSRestType(node) {
function TSNamedTupleMember(node) {
this.print(node.label, node);
- if (node.optional) this.token("?");
- this.token(":");
+ if (node.optional) this.tokenChar(63);
+ this.tokenChar(58);
this.space();
this.print(node.elementType, node);
}
@@ -449,11 +449,11 @@ function TSConditionalType(node) {
this.space();
this.print(node.extendsType);
this.space();
- this.token("?");
+ this.tokenChar(63);
this.space();
this.print(node.trueType);
this.space();
- this.token(":");
+ this.tokenChar(58);
this.space();
this.print(node.falseType);
}
@@ -465,9 +465,9 @@ function TSInferType(node) {
}
function TSParenthesizedType(node) {
- this.token("(");
+ this.tokenChar(40);
this.print(node.typeAnnotation, node);
- this.token(")");
+ this.tokenChar(41);
}
function TSTypeOperator(node) {
@@ -477,10 +477,10 @@ function TSTypeOperator(node) {
}
function TSIndexedAccessType(node) {
- this.print(node.objectType, node);
- this.token("[");
+ this.print(node.objectType, node, true);
+ this.tokenChar(91);
this.print(node.indexType, node);
- this.token("]");
+ this.tokenChar(93);
}
function TSMappedType(node) {
@@ -490,7 +490,7 @@ function TSMappedType(node) {
readonly,
typeParameter
} = node;
- this.token("{");
+ this.tokenChar(123);
this.space();
if (readonly) {
@@ -499,7 +499,7 @@ function TSMappedType(node) {
this.space();
}
- this.token("[");
+ this.tokenChar(91);
this.word(typeParameter.name);
this.space();
this.word("in");
@@ -513,18 +513,18 @@ function TSMappedType(node) {
this.print(nameType, node);
}
- this.token("]");
+ this.tokenChar(93);
if (optional) {
tokenIfPlusMinus(this, optional);
- this.token("?");
+ this.tokenChar(63);
}
- this.token(":");
+ this.tokenChar(58);
this.space();
this.print(node.typeAnnotation, node);
this.space();
- this.token("}");
+ this.tokenChar(125);
}
function tokenIfPlusMinus(self, tok) {
@@ -594,10 +594,10 @@ function TSTypeAliasDeclaration(node) {
this.print(id, node);
this.print(typeParameters, node);
this.space();
- this.token("=");
+ this.tokenChar(61);
this.space();
this.print(typeAnnotation, node);
- this.token(";");
+ this.tokenChar(59);
}
function TSAsExpression(node) {
@@ -617,9 +617,9 @@ function TSTypeAssertion(node) {
typeAnnotation,
expression
} = node;
- this.token("<");
+ this.tokenChar(60);
this.print(typeAnnotation, node);
- this.token(">");
+ this.tokenChar(62);
this.space();
this.print(expression, node);
}
@@ -663,12 +663,12 @@ function TSEnumMember(node) {
if (initializer) {
this.space();
- this.token("=");
+ this.tokenChar(61);
this.space();
this.print(initializer, node);
}
- this.token(",");
+ this.tokenChar(44);
}
function TSModuleDeclaration(node) {
@@ -690,14 +690,14 @@ function TSModuleDeclaration(node) {
this.print(id, node);
if (!node.body) {
- this.token(";");
+ this.tokenChar(59);
return;
}
let body = node.body;
while (body.type === "TSModuleDeclaration") {
- this.token(".");
+ this.tokenChar(46);
this.print(body.id, body);
body = body.body;
}
@@ -717,12 +717,12 @@ function TSImportType(node) {
typeParameters
} = node;
this.word("import");
- this.token("(");
+ this.tokenChar(40);
this.print(argument, node);
- this.token(")");
+ this.tokenChar(41);
if (qualifier) {
- this.token(".");
+ this.tokenChar(46);
this.print(qualifier, node);
}
@@ -747,30 +747,30 @@ function TSImportEqualsDeclaration(node) {
this.space();
this.print(id, node);
this.space();
- this.token("=");
+ this.tokenChar(61);
this.space();
this.print(moduleReference, node);
- this.token(";");
+ this.tokenChar(59);
}
function TSExternalModuleReference(node) {
this.token("require(");
this.print(node.expression, node);
- this.token(")");
+ this.tokenChar(41);
}
function TSNonNullExpression(node) {
this.print(node.expression, node);
- this.token("!");
+ this.tokenChar(33);
}
function TSExportAssignment(node) {
this.word("export");
this.space();
- this.token("=");
+ this.tokenChar(61);
this.space();
this.print(node.expression, node);
- this.token(";");
+ this.tokenChar(59);
}
function TSNamespaceExportDeclaration(node) {
@@ -789,11 +789,11 @@ function tsPrintSignatureDeclarationBase(node) {
} = node;
const parameters = node.parameters;
this.print(typeParameters, node);
- this.token("(");
+ this.tokenChar(40);
this._parameters(parameters, node);
- this.token(")");
+ this.tokenChar(41);
const returnType = node.typeAnnotation;
this.print(returnType, node);
}