@liftr/tscov
Version:
Check the type coverage of any TypeScript project with this easy npm package
827 lines • 53.8 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startLinter = void 0;
const tslib_1 = require("tslib");
const typescript_1 = tslib_1.__importDefault(require("typescript"));
const path = tslib_1.__importStar(require("path"));
const ts_config_1 = require("./ts-config");
const ignore_types_1 = require("./ignore-types");
// tslint:disable-next-line:no-big-function
async function startLinter(project, detail, debug, files, oldProgram) {
const { configFilePath, dirname } = ts_config_1.getTsConfigFilePath(project);
const config = ts_config_1.getTsConfig(configFilePath, dirname);
const { options: compilerOptions, errors } = typescript_1.default.convertCompilerOptionsFromJson(config.compilerOptions, dirname);
if (errors && errors.length > 0)
throw errors;
const rootNames = await ts_config_1.getRootNames(config, dirname);
const program = typescript_1.default.createProgram(rootNames, compilerOptions, undefined, oldProgram);
const checker = program.getTypeChecker();
let correctCount = 0;
let totalCount = 0;
let anys = [];
function collectData(node, file, sourceFile) {
const type = checker.getTypeAtLocation(node);
if (type) {
const { line, character } = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, node.getStart(sourceFile));
totalCount++;
if (type.flags === 1 && type.intrinsicName === 'any') {
if (debug) {
console.log(`type === any: ${file}:${line + 1}:${character + 1}: ${node.getText(sourceFile)}`);
}
else if (detail) {
anys.push({ file, line, character, text: node.getText(sourceFile) });
}
}
else {
correctCount++;
if (debug) {
console.log(`type !== any: ${file}:${line + 1}:${character + 1}: ${node.getText(sourceFile)} ${node.kind}(kind) ${type.flags}(flag) ${type.intrinsicName || ''}`);
}
}
}
}
function handleMultipleNodes(nodes, file, sourceFile) {
if (nodes === undefined)
return;
for (const node of nodes) {
handleSingleNode(node, file, sourceFile);
}
}
// tslint:disable-next-line:no-big-function
function handleSingleNode(node, file, sourceFile) {
if (node === undefined)
return;
if (debug) {
const { line, character } = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, node.getStart(sourceFile));
console.log(`node: ${file}:${line + 1}:${character + 1}: ${node.getText(sourceFile)} ${node.kind}(kind)`);
}
handleMultipleNodes(node.decorators, file, sourceFile);
handleMultipleNodes(node.modifiers, file, sourceFile);
if (ignore_types_1.ignoreTypes.has(node.kind))
return;
switch (node.kind) {
case typescript_1.default.SyntaxKind.Unknown:
case typescript_1.default.SyntaxKind.EndOfFileToken:
case typescript_1.default.SyntaxKind.SingleLineCommentTrivia:
case typescript_1.default.SyntaxKind.MultiLineCommentTrivia:
case typescript_1.default.SyntaxKind.NewLineTrivia:
case typescript_1.default.SyntaxKind.WhitespaceTrivia:
case typescript_1.default.SyntaxKind.ShebangTrivia:
case typescript_1.default.SyntaxKind.ConflictMarkerTrivia:
case typescript_1.default.SyntaxKind.NumericLiteral:
case typescript_1.default.SyntaxKind.StringLiteral:
case typescript_1.default.SyntaxKind.JsxText:
case typescript_1.default.SyntaxKind.JsxTextAllWhiteSpaces:
case typescript_1.default.SyntaxKind.RegularExpressionLiteral:
case typescript_1.default.SyntaxKind.NoSubstitutionTemplateLiteral:
case typescript_1.default.SyntaxKind.TemplateHead:
case typescript_1.default.SyntaxKind.TemplateMiddle:
case typescript_1.default.SyntaxKind.TemplateTail:
case typescript_1.default.SyntaxKind.OpenBraceToken:
case typescript_1.default.SyntaxKind.CloseBraceToken:
case typescript_1.default.SyntaxKind.OpenParenToken:
case typescript_1.default.SyntaxKind.CloseParenToken:
case typescript_1.default.SyntaxKind.OpenBracketToken:
case typescript_1.default.SyntaxKind.CloseBracketToken:
case typescript_1.default.SyntaxKind.DotToken:
case typescript_1.default.SyntaxKind.DotDotDotToken:
case typescript_1.default.SyntaxKind.SemicolonToken:
case typescript_1.default.SyntaxKind.CommaToken:
case typescript_1.default.SyntaxKind.LessThanToken:
case typescript_1.default.SyntaxKind.LessThanSlashToken:
case typescript_1.default.SyntaxKind.GreaterThanToken:
case typescript_1.default.SyntaxKind.LessThanEqualsToken:
case typescript_1.default.SyntaxKind.GreaterThanEqualsToken:
case typescript_1.default.SyntaxKind.EqualsEqualsToken:
case typescript_1.default.SyntaxKind.ExclamationEqualsToken:
case typescript_1.default.SyntaxKind.EqualsEqualsEqualsToken:
case typescript_1.default.SyntaxKind.ExclamationEqualsEqualsToken:
case typescript_1.default.SyntaxKind.EqualsGreaterThanToken:
case typescript_1.default.SyntaxKind.PlusToken:
case typescript_1.default.SyntaxKind.MinusToken:
case typescript_1.default.SyntaxKind.AsteriskToken:
case typescript_1.default.SyntaxKind.AsteriskAsteriskToken:
case typescript_1.default.SyntaxKind.SlashToken:
case typescript_1.default.SyntaxKind.PercentToken:
case typescript_1.default.SyntaxKind.PlusPlusToken:
case typescript_1.default.SyntaxKind.MinusMinusToken:
case typescript_1.default.SyntaxKind.LessThanLessThanToken:
case typescript_1.default.SyntaxKind.GreaterThanGreaterThanToken:
case typescript_1.default.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case typescript_1.default.SyntaxKind.AmpersandToken:
case typescript_1.default.SyntaxKind.BarToken:
case typescript_1.default.SyntaxKind.CaretToken:
case typescript_1.default.SyntaxKind.ExclamationToken:
case typescript_1.default.SyntaxKind.TildeToken:
case typescript_1.default.SyntaxKind.AmpersandAmpersandToken:
case typescript_1.default.SyntaxKind.BarBarToken:
case typescript_1.default.SyntaxKind.QuestionToken:
case typescript_1.default.SyntaxKind.ColonToken:
case typescript_1.default.SyntaxKind.AtToken:
case typescript_1.default.SyntaxKind.EqualsToken:
case typescript_1.default.SyntaxKind.PlusEqualsToken:
case typescript_1.default.SyntaxKind.MinusEqualsToken:
case typescript_1.default.SyntaxKind.AsteriskEqualsToken:
case typescript_1.default.SyntaxKind.AsteriskAsteriskEqualsToken:
case typescript_1.default.SyntaxKind.SlashEqualsToken:
case typescript_1.default.SyntaxKind.PercentEqualsToken:
case typescript_1.default.SyntaxKind.LessThanLessThanEqualsToken:
case typescript_1.default.SyntaxKind.GreaterThanGreaterThanEqualsToken:
case typescript_1.default.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
case typescript_1.default.SyntaxKind.AmpersandEqualsToken:
case typescript_1.default.SyntaxKind.BarEqualsToken:
case typescript_1.default.SyntaxKind.CaretEqualsToken:
break;
case typescript_1.default.SyntaxKind.Identifier:
collectData(node, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.BreakKeyword:
case typescript_1.default.SyntaxKind.CaseKeyword:
case typescript_1.default.SyntaxKind.CatchKeyword:
case typescript_1.default.SyntaxKind.ClassKeyword:
case typescript_1.default.SyntaxKind.ConstKeyword:
case typescript_1.default.SyntaxKind.ContinueKeyword:
case typescript_1.default.SyntaxKind.DebuggerKeyword:
case typescript_1.default.SyntaxKind.DefaultKeyword:
case typescript_1.default.SyntaxKind.DeleteKeyword:
case typescript_1.default.SyntaxKind.DoKeyword:
case typescript_1.default.SyntaxKind.ElseKeyword:
case typescript_1.default.SyntaxKind.EnumKeyword:
case typescript_1.default.SyntaxKind.ExportKeyword:
case typescript_1.default.SyntaxKind.ExtendsKeyword:
case typescript_1.default.SyntaxKind.FalseKeyword:
case typescript_1.default.SyntaxKind.FinallyKeyword:
case typescript_1.default.SyntaxKind.ForKeyword:
case typescript_1.default.SyntaxKind.FunctionKeyword:
case typescript_1.default.SyntaxKind.IfKeyword:
case typescript_1.default.SyntaxKind.ImportKeyword:
case typescript_1.default.SyntaxKind.InKeyword:
case typescript_1.default.SyntaxKind.InstanceOfKeyword:
case typescript_1.default.SyntaxKind.NewKeyword:
case typescript_1.default.SyntaxKind.NullKeyword:
case typescript_1.default.SyntaxKind.ReturnKeyword:
case typescript_1.default.SyntaxKind.SuperKeyword:
case typescript_1.default.SyntaxKind.SwitchKeyword:
break;
case typescript_1.default.SyntaxKind.ThisKeyword:
collectData(node, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ThrowKeyword:
case typescript_1.default.SyntaxKind.TrueKeyword:
case typescript_1.default.SyntaxKind.TryKeyword:
case typescript_1.default.SyntaxKind.TypeOfKeyword:
case typescript_1.default.SyntaxKind.VarKeyword:
case typescript_1.default.SyntaxKind.VoidKeyword:
case typescript_1.default.SyntaxKind.WhileKeyword:
case typescript_1.default.SyntaxKind.WithKeyword:
case typescript_1.default.SyntaxKind.ImplementsKeyword:
case typescript_1.default.SyntaxKind.InterfaceKeyword:
case typescript_1.default.SyntaxKind.LetKeyword:
case typescript_1.default.SyntaxKind.PackageKeyword:
case typescript_1.default.SyntaxKind.PrivateKeyword:
case typescript_1.default.SyntaxKind.ProtectedKeyword:
case typescript_1.default.SyntaxKind.PublicKeyword:
case typescript_1.default.SyntaxKind.StaticKeyword:
case typescript_1.default.SyntaxKind.YieldKeyword:
case typescript_1.default.SyntaxKind.AbstractKeyword:
case typescript_1.default.SyntaxKind.AsKeyword:
case typescript_1.default.SyntaxKind.AnyKeyword:
case typescript_1.default.SyntaxKind.AsyncKeyword:
case typescript_1.default.SyntaxKind.AwaitKeyword:
case typescript_1.default.SyntaxKind.BooleanKeyword:
case typescript_1.default.SyntaxKind.ConstructorKeyword:
case typescript_1.default.SyntaxKind.DeclareKeyword:
case typescript_1.default.SyntaxKind.GetKeyword:
case typescript_1.default.SyntaxKind.IsKeyword:
case typescript_1.default.SyntaxKind.KeyOfKeyword:
case typescript_1.default.SyntaxKind.ModuleKeyword:
case typescript_1.default.SyntaxKind.NamespaceKeyword:
case typescript_1.default.SyntaxKind.NeverKeyword:
case typescript_1.default.SyntaxKind.ReadonlyKeyword:
case typescript_1.default.SyntaxKind.RequireKeyword:
case typescript_1.default.SyntaxKind.NumberKeyword:
case typescript_1.default.SyntaxKind.ObjectKeyword:
case typescript_1.default.SyntaxKind.SetKeyword:
case typescript_1.default.SyntaxKind.StringKeyword:
case typescript_1.default.SyntaxKind.SymbolKeyword:
case typescript_1.default.SyntaxKind.TypeKeyword:
case typescript_1.default.SyntaxKind.UndefinedKeyword:
case typescript_1.default.SyntaxKind.UniqueKeyword:
case typescript_1.default.SyntaxKind.UnknownKeyword:
case typescript_1.default.SyntaxKind.FromKeyword:
case typescript_1.default.SyntaxKind.GlobalKeyword:
case typescript_1.default.SyntaxKind.BigIntKeyword:
case typescript_1.default.SyntaxKind.OfKeyword:
break;
case typescript_1.default.SyntaxKind.QualifiedName:
const qualifiedName = node;
handleSingleNode(qualifiedName.left, file, sourceFile);
handleSingleNode(qualifiedName.right, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ComputedPropertyName:
const computedPropertyName = node;
handleSingleNode(computedPropertyName.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TypeParameter:
const typeParameterDeclaration = node;
handleSingleNode(typeParameterDeclaration.name, file, sourceFile);
handleSingleNode(typeParameterDeclaration.default, file, sourceFile);
handleSingleNode(typeParameterDeclaration.expression, file, sourceFile);
handleSingleNode(typeParameterDeclaration.constraint, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.Parameter:
const parameterDeclaration = node;
handleSingleNode(parameterDeclaration.dotDotDotToken, file, sourceFile);
handleSingleNode(parameterDeclaration.name, file, sourceFile);
handleSingleNode(parameterDeclaration.initializer, file, sourceFile);
handleSingleNode(parameterDeclaration.type, file, sourceFile);
handleSingleNode(parameterDeclaration.questionToken, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.Decorator:
const decorator = node;
handleSingleNode(decorator.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.PropertySignature:
const propertySignature = node;
handleSingleNode(propertySignature.name, file, sourceFile);
handleSingleNode(propertySignature.questionToken, file, sourceFile);
handleSingleNode(propertySignature.type, file, sourceFile);
handleSingleNode(propertySignature.initializer, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.PropertyDeclaration:
const propertyDeclaration = node;
handleSingleNode(propertyDeclaration.name, file, sourceFile);
handleSingleNode(propertyDeclaration.initializer, file, sourceFile);
handleSingleNode(propertyDeclaration.type, file, sourceFile);
handleSingleNode(propertyDeclaration.questionToken, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.MethodSignature:
const methodSignature = node;
handleSingleNode(methodSignature.name, file, sourceFile);
handleMultipleNodes(methodSignature.parameters, file, sourceFile);
handleSingleNode(methodSignature.questionToken, file, sourceFile);
handleSingleNode(methodSignature.type, file, sourceFile);
handleMultipleNodes(methodSignature.typeParameters, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.MethodDeclaration:
case typescript_1.default.SyntaxKind.Constructor:
case typescript_1.default.SyntaxKind.GetAccessor:
case typescript_1.default.SyntaxKind.SetAccessor:
const functionLikeDeclarationBase = node;
handleSingleNode(functionLikeDeclarationBase.name, file, sourceFile);
handleMultipleNodes(functionLikeDeclarationBase.parameters, file, sourceFile);
handleSingleNode(functionLikeDeclarationBase.body, file, sourceFile);
handleSingleNode(functionLikeDeclarationBase.asteriskToken, file, sourceFile);
handleSingleNode(functionLikeDeclarationBase.questionToken, file, sourceFile);
handleSingleNode(functionLikeDeclarationBase.type, file, sourceFile);
handleMultipleNodes(functionLikeDeclarationBase.typeParameters, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.CallSignature:
const callSignatureDeclaration = node;
handleSingleNode(callSignatureDeclaration.name, file, sourceFile);
handleMultipleNodes(callSignatureDeclaration.parameters, file, sourceFile);
handleSingleNode(callSignatureDeclaration.questionToken, file, sourceFile);
handleSingleNode(callSignatureDeclaration.type, file, sourceFile);
handleMultipleNodes(callSignatureDeclaration.typeParameters, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ConstructSignature:
const constructSignatureDeclaration = node;
handleSingleNode(constructSignatureDeclaration.name, file, sourceFile);
handleMultipleNodes(constructSignatureDeclaration.parameters, file, sourceFile);
handleSingleNode(constructSignatureDeclaration.questionToken, file, sourceFile);
handleSingleNode(constructSignatureDeclaration.type, file, sourceFile);
handleMultipleNodes(constructSignatureDeclaration.typeParameters, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.IndexSignature:
const indexSignatureDeclaration = node;
handleSingleNode(indexSignatureDeclaration.name, file, sourceFile);
handleMultipleNodes(indexSignatureDeclaration.parameters, file, sourceFile);
handleSingleNode(indexSignatureDeclaration.questionToken, file, sourceFile);
handleSingleNode(indexSignatureDeclaration.type, file, sourceFile);
handleMultipleNodes(indexSignatureDeclaration.typeParameters, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TypePredicate:
const typePredicateNode = node;
handleSingleNode(typePredicateNode.type, file, sourceFile);
handleSingleNode(typePredicateNode.parameterName, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TypeReference:
const typeReferenceNode = node;
handleSingleNode(typeReferenceNode.typeName, file, sourceFile);
handleMultipleNodes(typeReferenceNode.typeArguments, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.FunctionType:
case typescript_1.default.SyntaxKind.ConstructorType:
const signatureDeclarationBase = node;
handleSingleNode(signatureDeclarationBase.name, file, sourceFile);
handleMultipleNodes(signatureDeclarationBase.parameters, file, sourceFile);
handleSingleNode(signatureDeclarationBase.type, file, sourceFile);
handleMultipleNodes(signatureDeclarationBase.typeParameters, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TypeQuery:
const typeQueryNode = node;
handleSingleNode(typeQueryNode.exprName, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TypeLiteral:
const typeLiteralNode = node;
handleMultipleNodes(typeLiteralNode.members, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ArrayType:
const arrayTypeNode = node;
handleSingleNode(arrayTypeNode.elementType, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.OptionalType:
break;
case typescript_1.default.SyntaxKind.RestType:
const restTypeNode = node;
handleSingleNode(restTypeNode.type, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.UnionType:
const unionTypeNode = node;
handleMultipleNodes(unionTypeNode.types, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.IntersectionType:
const intersectionTypeNode = node;
handleMultipleNodes(intersectionTypeNode.types, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ConditionalType:
const conditionalTypeNode = node;
handleSingleNode(conditionalTypeNode.checkType, file, sourceFile);
handleSingleNode(conditionalTypeNode.extendsType, file, sourceFile);
handleSingleNode(conditionalTypeNode.trueType, file, sourceFile);
handleSingleNode(conditionalTypeNode.falseType, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.InferType:
const inferTypeNode = node;
handleSingleNode(inferTypeNode.typeParameter, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ParenthesizedType:
const parenthesizedTypeNode = node;
handleSingleNode(parenthesizedTypeNode.type, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ThisType:
break;
case typescript_1.default.SyntaxKind.TypeOperator:
const typeOperatorNode = node;
handleSingleNode(typeOperatorNode.type, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.IndexedAccessType:
const indexedAccessTypeNode = node;
handleSingleNode(indexedAccessTypeNode.objectType, file, sourceFile);
handleSingleNode(indexedAccessTypeNode.indexType, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.MappedType:
const mappedTypeNode = node;
handleSingleNode(mappedTypeNode.questionToken, file, sourceFile);
handleSingleNode(mappedTypeNode.readonlyToken, file, sourceFile);
handleSingleNode(mappedTypeNode.type, file, sourceFile);
handleSingleNode(mappedTypeNode.typeParameter, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.LiteralType:
const literalTypeNode = node;
handleSingleNode(literalTypeNode.literal, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ImportType:
const importTypeNode = node;
handleSingleNode(importTypeNode.qualifier, file, sourceFile);
handleSingleNode(importTypeNode.argument, file, sourceFile);
handleMultipleNodes(importTypeNode.typeArguments, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ObjectBindingPattern:
const objectBindingPattern = node;
handleMultipleNodes(objectBindingPattern.elements, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ArrayBindingPattern:
const arrayBindingPattern = node;
handleMultipleNodes(arrayBindingPattern.elements, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.BindingElement:
const bindingElement = node;
handleSingleNode(bindingElement.name, file, sourceFile);
handleSingleNode(bindingElement.initializer, file, sourceFile);
handleSingleNode(bindingElement.dotDotDotToken, file, sourceFile);
handleSingleNode(bindingElement.propertyName, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ArrayLiteralExpression:
const arrayLiteralExpression = node;
handleMultipleNodes(arrayLiteralExpression.elements, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ObjectLiteralExpression:
const objectLiteralExpression = node;
handleMultipleNodes(objectLiteralExpression.properties, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.PropertyAccessExpression:
const propertyAccessExpression = node;
handleSingleNode(propertyAccessExpression.expression, file, sourceFile);
handleSingleNode(propertyAccessExpression.name, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ElementAccessExpression:
const elementAccessExpression = node;
handleSingleNode(elementAccessExpression.expression, file, sourceFile);
handleSingleNode(elementAccessExpression.argumentExpression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.CallExpression:
const callExpression = node;
handleSingleNode(callExpression.expression, file, sourceFile);
handleMultipleNodes(callExpression.arguments, file, sourceFile);
handleMultipleNodes(callExpression.typeArguments, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.NewExpression:
const newExpression = node;
handleSingleNode(newExpression.expression, file, sourceFile);
handleMultipleNodes(newExpression.arguments, file, sourceFile);
handleMultipleNodes(newExpression.typeArguments, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TaggedTemplateExpression:
const taggedTemplateExpression = node;
handleSingleNode(taggedTemplateExpression.template, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TypeAssertionExpression:
const typeAssertion = node;
handleSingleNode(typeAssertion.expression, file, sourceFile);
handleSingleNode(typeAssertion.type, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ParenthesizedExpression:
const parenthesizedExpression = node;
handleSingleNode(parenthesizedExpression.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.FunctionExpression:
const functionExpression = node;
handleSingleNode(functionExpression.name, file, sourceFile);
handleMultipleNodes(functionExpression.parameters, file, sourceFile);
handleSingleNode(functionExpression.body, file, sourceFile);
handleSingleNode(functionExpression.asteriskToken, file, sourceFile);
handleSingleNode(functionExpression.questionToken, file, sourceFile);
handleSingleNode(functionExpression.type, file, sourceFile);
handleMultipleNodes(functionExpression.typeParameters, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ArrowFunction:
const arrowFunction = node;
handleSingleNode(arrowFunction.name, file, sourceFile);
handleMultipleNodes(arrowFunction.parameters, file, sourceFile);
handleSingleNode(arrowFunction.body, file, sourceFile);
handleSingleNode(arrowFunction.asteriskToken, file, sourceFile);
handleSingleNode(arrowFunction.questionToken, file, sourceFile);
handleSingleNode(arrowFunction.type, file, sourceFile);
handleMultipleNodes(arrowFunction.typeParameters, file, sourceFile);
handleSingleNode(arrowFunction.equalsGreaterThanToken, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.DeleteExpression:
const deleteExpression = node;
handleSingleNode(deleteExpression.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TypeOfExpression:
const typeOfExpression = node;
handleSingleNode(typeOfExpression.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.VoidExpression:
const voidExpression = node;
handleSingleNode(voidExpression.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.AwaitExpression:
const awaitExpression = node;
handleSingleNode(awaitExpression.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.PrefixUnaryExpression:
const prefixUnaryExpression = node;
handleSingleNode(prefixUnaryExpression.operand, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.PostfixUnaryExpression:
const postfixUnaryExpression = node;
handleSingleNode(postfixUnaryExpression.operand, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.BinaryExpression:
const binaryExpression = node;
handleSingleNode(binaryExpression.left, file, sourceFile);
handleSingleNode(binaryExpression.right, file, sourceFile);
handleSingleNode(binaryExpression.operatorToken, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ConditionalExpression:
const conditionalExpression = node;
handleSingleNode(conditionalExpression.condition, file, sourceFile);
handleSingleNode(conditionalExpression.colonToken, file, sourceFile);
handleSingleNode(conditionalExpression.questionToken, file, sourceFile);
handleSingleNode(conditionalExpression.whenTrue, file, sourceFile);
handleSingleNode(conditionalExpression.whenFalse, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TemplateExpression:
const templateExpression = node;
handleMultipleNodes(templateExpression.templateSpans, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.YieldExpression:
const yieldExpression = node;
handleSingleNode(yieldExpression.asteriskToken, file, sourceFile);
handleSingleNode(yieldExpression.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.SpreadElement:
const spreadElement = node;
handleSingleNode(spreadElement.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ClassExpression:
const classExpression = node;
handleSingleNode(classExpression.name, file, sourceFile);
handleMultipleNodes(classExpression.typeParameters, file, sourceFile);
handleMultipleNodes(classExpression.members, file, sourceFile);
handleMultipleNodes(classExpression.heritageClauses, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.OmittedExpression:
break;
case typescript_1.default.SyntaxKind.ExpressionWithTypeArguments:
const expressionWithTypeArguments = node;
handleSingleNode(expressionWithTypeArguments.expression, file, sourceFile);
handleMultipleNodes(expressionWithTypeArguments.typeArguments, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.AsExpression:
const asExpression = node;
handleSingleNode(asExpression.expression, file, sourceFile);
handleSingleNode(asExpression.type, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.NonNullExpression:
const nonNullExpression = node;
handleSingleNode(nonNullExpression.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.MetaProperty:
const metaProperty = node;
handleSingleNode(metaProperty.name, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TemplateSpan:
const templateSpan = node;
handleSingleNode(templateSpan.expression, file, sourceFile);
handleSingleNode(templateSpan.literal, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.SemicolonClassElement:
const semicolonClassElement = node;
handleSingleNode(semicolonClassElement.name, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.Block:
const block = node;
handleMultipleNodes(block.statements, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.VariableStatement:
const variableStatement = node;
handleSingleNode(variableStatement.declarationList, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.EmptyStatement:
break;
case typescript_1.default.SyntaxKind.ExpressionStatement:
const expressionStatement = node;
handleSingleNode(expressionStatement.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.IfStatement:
const ifStatement = node;
handleSingleNode(ifStatement.expression, file, sourceFile);
handleSingleNode(ifStatement.thenStatement, file, sourceFile);
handleSingleNode(ifStatement.elseStatement, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.DoStatement:
const doStatement = node;
handleSingleNode(doStatement.expression, file, sourceFile);
handleSingleNode(doStatement.statement, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.WhileStatement:
const whileStatement = node;
handleSingleNode(whileStatement.statement, file, sourceFile);
handleSingleNode(whileStatement.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ForStatement:
const forStatement = node;
handleSingleNode(forStatement.initializer, file, sourceFile);
handleSingleNode(forStatement.condition, file, sourceFile);
handleSingleNode(forStatement.incrementor, file, sourceFile);
handleSingleNode(forStatement.statement, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ForInStatement:
const forInStatement = node;
handleSingleNode(forInStatement.initializer, file, sourceFile);
handleSingleNode(forInStatement.expression, file, sourceFile);
handleSingleNode(forInStatement.statement, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ForOfStatement:
const forOfStatement = node;
handleSingleNode(forOfStatement.initializer, file, sourceFile);
handleSingleNode(forOfStatement.statement, file, sourceFile);
handleSingleNode(forOfStatement.expression, file, sourceFile);
handleSingleNode(forOfStatement.awaitModifier, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ContinueStatement:
case typescript_1.default.SyntaxKind.BreakStatement:
break;
case typescript_1.default.SyntaxKind.ReturnStatement:
const returnStatement = node;
handleSingleNode(returnStatement.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.WithStatement:
const withStatement = node;
handleSingleNode(withStatement.expression, file, sourceFile);
handleSingleNode(withStatement.statement, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.SwitchStatement:
const switchStatement = node;
handleSingleNode(switchStatement.expression, file, sourceFile);
handleSingleNode(switchStatement.caseBlock, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.LabeledStatement:
const labeledStatement = node;
handleSingleNode(labeledStatement.label, file, sourceFile);
handleSingleNode(labeledStatement.statement, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ThrowStatement:
const throwStatement = node;
handleSingleNode(throwStatement.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TryStatement:
const tryStatement = node;
handleSingleNode(tryStatement.tryBlock, file, sourceFile);
handleSingleNode(tryStatement.finallyBlock, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.DebuggerStatement:
break;
case typescript_1.default.SyntaxKind.VariableDeclaration:
const variableDeclaration = node;
handleSingleNode(variableDeclaration.name, file, sourceFile);
handleSingleNode(variableDeclaration.type, file, sourceFile);
handleSingleNode(variableDeclaration.initializer, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.VariableDeclarationList:
const declarationList = node;
handleMultipleNodes(declarationList.declarations, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.FunctionDeclaration:
const functionDeclaration = node;
handleSingleNode(functionDeclaration.name, file, sourceFile);
handleMultipleNodes(functionDeclaration.parameters, file, sourceFile);
handleSingleNode(functionDeclaration.body, file, sourceFile);
handleSingleNode(functionDeclaration.asteriskToken, file, sourceFile);
handleSingleNode(functionDeclaration.questionToken, file, sourceFile);
handleSingleNode(functionDeclaration.type, file, sourceFile);
handleMultipleNodes(functionDeclaration.typeParameters, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ClassDeclaration:
const classDeclaration = node;
handleSingleNode(classDeclaration.name, file, sourceFile);
handleMultipleNodes(classDeclaration.members, file, sourceFile);
handleMultipleNodes(classDeclaration.typeParameters, file, sourceFile);
handleMultipleNodes(classDeclaration.heritageClauses, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.InterfaceDeclaration:
const interfaceDeclaration = node;
handleSingleNode(interfaceDeclaration.name, file, sourceFile);
handleMultipleNodes(interfaceDeclaration.members, file, sourceFile);
handleMultipleNodes(interfaceDeclaration.typeParameters, file, sourceFile);
handleMultipleNodes(interfaceDeclaration.heritageClauses, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.TypeAliasDeclaration:
const typeAliasDeclaration = node;
handleSingleNode(typeAliasDeclaration.name, file, sourceFile);
handleSingleNode(typeAliasDeclaration.type, file, sourceFile);
handleMultipleNodes(typeAliasDeclaration.typeParameters, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.EnumDeclaration:
const enumDeclaration = node;
handleSingleNode(enumDeclaration.name, file, sourceFile);
handleMultipleNodes(enumDeclaration.members, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ModuleDeclaration:
const moduleDeclaration = node;
handleSingleNode(moduleDeclaration.name, file, sourceFile);
handleSingleNode(moduleDeclaration.body, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ModuleBlock:
const moduleBlock = node;
handleMultipleNodes(moduleBlock.statements, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.CaseBlock:
const caseBlock = node;
handleMultipleNodes(caseBlock.clauses, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.NamespaceExportDeclaration:
const namespaceExportDeclaration = node;
handleSingleNode(namespaceExportDeclaration.name, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ImportEqualsDeclaration:
const importEqualsDeclaration = node;
handleSingleNode(importEqualsDeclaration.name, file, sourceFile);
handleSingleNode(importEqualsDeclaration.moduleReference, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ImportDeclaration:
const importDeclaration = node;
handleSingleNode(importDeclaration.importClause, file, sourceFile);
handleSingleNode(importDeclaration.moduleSpecifier, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ImportClause:
const importClause = node;
handleSingleNode(importClause.name, file, sourceFile);
handleSingleNode(importClause.namedBindings, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.NamespaceImport:
const namespaceImport = node;
handleSingleNode(namespaceImport.name, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.NamedImports:
const namedImports = node;
handleMultipleNodes(namedImports.elements, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ImportSpecifier:
const importSpecifier = node;
handleSingleNode(importSpecifier.name, file, sourceFile);
handleSingleNode(importSpecifier.propertyName, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ExportAssignment:
const exportAssignment = node;
handleSingleNode(exportAssignment.name, file, sourceFile);
handleSingleNode(exportAssignment.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ExportDeclaration:
const exportDeclaration = node;
handleSingleNode(exportDeclaration.exportClause, file, sourceFile);
handleSingleNode(exportDeclaration.name, file, sourceFile);
handleSingleNode(exportDeclaration.moduleSpecifier, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.NamedExports:
const namedExports = node;
handleMultipleNodes(namedExports.elements, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ExportSpecifier:
const exportSpecifier = node;
handleSingleNode(exportSpecifier.name, file, sourceFile);
handleSingleNode(exportSpecifier.propertyName, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.MissingDeclaration:
const missingDeclaration = node;
handleSingleNode(missingDeclaration.name, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.ExternalModuleReference:
const externalModuleReference = node;
handleSingleNode(externalModuleReference.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.JsxElement:
const jsxElement = node;
handleSingleNode(jsxElement.openingElement, file, sourceFile);
handleSingleNode(jsxElement.closingElement, file, sourceFile);
handleMultipleNodes(jsxElement.children, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.JsxSelfClosingElement:
const jsxSelfClosingElement = node;
handleSingleNode(jsxSelfClosingElement.attributes, file, sourceFile);
handleSingleNode(jsxSelfClosingElement.tagName, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.JsxOpeningElement:
const jsxOpeningElement = node;
handleSingleNode(jsxOpeningElement.attributes, file, sourceFile);
handleSingleNode(jsxOpeningElement.tagName, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.JsxClosingElement:
const jsxClosingElement = node;
handleSingleNode(jsxClosingElement.tagName, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.JsxFragment:
const jsxFragment = node;
handleSingleNode(jsxFragment.openingFragment, file, sourceFile);
handleSingleNode(jsxFragment.closingFragment, file, sourceFile);
handleMultipleNodes(jsxFragment.children, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.JsxOpeningFragment:
break;
case typescript_1.default.SyntaxKind.JsxClosingFragment:
break;
case typescript_1.default.SyntaxKind.JsxAttribute:
const jsxAttribute = node;
handleSingleNode(jsxAttribute.name, file, sourceFile);
handleSingleNode(jsxAttribute.initializer, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.JsxAttributes:
const jsxAttributes = node;
handleMultipleNodes(jsxAttributes.properties, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.JsxSpreadAttribute:
const jsxSpreadAttribute = node;
handleSingleNode(jsxSpreadAttribute.name, file, sourceFile);
handleSingleNode(jsxSpreadAttribute.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.JsxExpression:
const jsxExpression = node;
handleSingleNode(jsxExpression.dotDotDotToken, file, sourceFile);
handleSingleNode(jsxExpression.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.CaseClause:
const caseClause = node;
handleMultipleNodes(caseClause.statements, file, sourceFile);
handleSingleNode(caseClause.expression, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.DefaultClause:
const defaultClause = node;
handleMultipleNodes(defaultClause.statements, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.HeritageClause:
const heritageClause = node;
handleMultipleNodes(heritageClause.types, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.CatchClause:
const catchClause = node;
handleSingleNode(catchClause.block, file, sourceFile);
break;
case typescript_1.default.SyntaxKind.PropertyAssignment:
const propertyAssignmentExpression = node;
handleSingleNode(propertyAssignmentExpression.name, file, sourceFile);
handleSingleNode(propertyAssignmentExpression.questionToken, file, sourceFile);
handleSingleNode(propertyAssignmentExpression.initia