type-coverage
Advanced tools
Comparing version 1.0.4 to 1.0.5
1124
dist/index.js
@@ -92,2 +92,10 @@ "use strict"; | ||
} | ||
function handleNodes(nodes, file, sourceFile) { | ||
if (nodes === undefined) { | ||
return; | ||
} | ||
for (const node of nodes) { | ||
handleNode(node, file, sourceFile); | ||
} | ||
} | ||
function handleNode(node, file, sourceFile) { | ||
@@ -101,327 +109,797 @@ if (node === undefined) { | ||
} | ||
if (node.kind === ts.SyntaxKind.CallExpression) { | ||
const callExpression = node; | ||
handleNode(callExpression.expression, file, sourceFile); | ||
for (const parameter of callExpression.arguments) { | ||
handleNode(parameter, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.ForOfStatement) { | ||
const forOfStatement = node; | ||
handleNode(forOfStatement.statement, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ArrowFunction | ||
|| node.kind === ts.SyntaxKind.ModuleDeclaration) { | ||
const declaration = node; | ||
handleNode(declaration.body, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.PropertyAssignment) { | ||
const propertyAssignmentExpression = node; | ||
handleNode(propertyAssignmentExpression.initializer, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.PrefixUnaryExpression | ||
|| node.kind === ts.SyntaxKind.PostfixUnaryExpression) { | ||
const prefixUnaryExpression = node; | ||
handleNode(prefixUnaryExpression.operand, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.PropertyAccessExpression) { | ||
const propertyAccessExpression = node; | ||
handleNode(propertyAccessExpression.expression, file, sourceFile); | ||
handleNode(propertyAccessExpression.name, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ExportSpecifier) { | ||
const exportSpecifier = node; | ||
handleNode(exportSpecifier.name, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.VariableDeclaration) { | ||
const expression = node; | ||
handleNode(expression.name, file, sourceFile); | ||
handleNode(expression.initializer, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ExportDeclaration) { | ||
const exportDeclaration = node; | ||
handleNode(exportDeclaration.exportClause, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.TemplateSpan | ||
|| node.kind === ts.SyntaxKind.ReturnStatement | ||
|| node.kind === ts.SyntaxKind.AsExpression | ||
|| node.kind === ts.SyntaxKind.SpreadElement | ||
|| node.kind === ts.SyntaxKind.ExpressionStatement | ||
|| node.kind === ts.SyntaxKind.AwaitExpression | ||
|| node.kind === ts.SyntaxKind.NewExpression | ||
|| node.kind === ts.SyntaxKind.ParenthesizedExpression | ||
|| node.kind === ts.SyntaxKind.TypeOfExpression | ||
|| node.kind === ts.SyntaxKind.NonNullExpression | ||
|| node.kind === ts.SyntaxKind.ThrowStatement | ||
|| node.kind === ts.SyntaxKind.ExportAssignment | ||
|| node.kind === ts.SyntaxKind.DeleteExpression | ||
|| node.kind === ts.SyntaxKind.VoidExpression | ||
|| node.kind === ts.SyntaxKind.TypeAssertionExpression) { | ||
const expression = node; | ||
handleNode(expression.expression, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.Block | ||
|| node.kind === ts.SyntaxKind.CaseClause | ||
|| node.kind === ts.SyntaxKind.DefaultClause) { | ||
const statements = node.statements; | ||
for (const statement of statements) { | ||
handleNode(statement, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.IfStatement) { | ||
const ifStatement = node; | ||
handleNode(ifStatement.expression, file, sourceFile); | ||
handleNode(ifStatement.thenStatement, file, sourceFile); | ||
handleNode(ifStatement.elseStatement, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.BinaryExpression) { | ||
const binaryExpression = node; | ||
handleNode(binaryExpression.left, file, sourceFile); | ||
handleNode(binaryExpression.right, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.VariableStatement) { | ||
const variableStatement = node; | ||
handleNode(variableStatement.declarationList, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.TemplateExpression) { | ||
const templateExpression = node; | ||
for (const span of templateExpression.templateSpans) { | ||
handleNode(span, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.ArrayLiteralExpression) { | ||
const arrayLiteralExpression = node; | ||
for (const element of arrayLiteralExpression.elements) { | ||
handleNode(element, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.ObjectLiteralExpression) { | ||
const objectLiteralExpression = node; | ||
for (const property of objectLiteralExpression.properties) { | ||
handleNode(property, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.NamedExports) { | ||
const namedExports = node; | ||
for (const element of namedExports.elements) { | ||
handleNode(element, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.ModuleBlock) { | ||
const moduleBlock = node; | ||
for (const statement of moduleBlock.statements) { | ||
handleNode(statement, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.SwitchStatement) { | ||
const switchStatement = node; | ||
handleNode(switchStatement.expression, file, sourceFile); | ||
handleNode(switchStatement.caseBlock, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ConditionalExpression) { | ||
const conditionalExpression = node; | ||
handleNode(conditionalExpression.whenTrue, file, sourceFile); | ||
handleNode(conditionalExpression.whenFalse, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.CaseBlock) { | ||
const caseBlock = node; | ||
for (const clause of caseBlock.clauses) { | ||
handleNode(clause, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.ForStatement) { | ||
const forStatement = node; | ||
handleNode(forStatement.initializer, file, sourceFile); | ||
handleNode(forStatement.condition, file, sourceFile); | ||
handleNode(forStatement.incrementor, file, sourceFile); | ||
handleNode(forStatement.statement, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.TryStatement) { | ||
const tryStatement = node; | ||
handleNode(tryStatement.tryBlock, file, sourceFile); | ||
handleNode(tryStatement.catchClause, file, sourceFile); | ||
handleNode(tryStatement.finallyBlock, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.VariableDeclarationList) { | ||
const declarationList = node; | ||
for (const declaration of declarationList.declarations) { | ||
handleNode(declaration, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.CatchClause) { | ||
const catchClause = node; | ||
handleNode(catchClause.variableDeclaration, file, sourceFile); | ||
handleNode(catchClause.block, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ForInStatement) { | ||
const forInStatement = node; | ||
handleNode(forInStatement.initializer, file, sourceFile); | ||
handleNode(forInStatement.expression, file, sourceFile); | ||
handleNode(forInStatement.statement, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.WhileStatement) { | ||
const whileStatement = node; | ||
handleNode(whileStatement.statement, file, sourceFile); | ||
handleNode(whileStatement.expression, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ElementAccessExpression) { | ||
const elementAccessExpression = node; | ||
handleNode(elementAccessExpression.expression, file, sourceFile); | ||
handleNode(elementAccessExpression.argumentExpression, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.FunctionExpression) { | ||
const functionExpression = node; | ||
handleNode(functionExpression.body, file, sourceFile); | ||
handleNode(functionExpression.name, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.FunctionDeclaration) { | ||
const functionDeclaration = node; | ||
handleNode(functionDeclaration.body, file, sourceFile); | ||
for (const parameter of functionDeclaration.parameters) { | ||
handleNode(parameter, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.Identifier) { | ||
collectData(node, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ObjectBindingPattern) { | ||
const objectBindingPattern = node; | ||
for (const element of objectBindingPattern.elements) { | ||
handleNode(element, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.BindingElement) { | ||
const bindingElement = node; | ||
handleNode(bindingElement.name, file, sourceFile); | ||
if (bindingElement.initializer) { | ||
handleNodes(node.decorators, file, sourceFile); | ||
handleNodes(node.modifiers, file, sourceFile); | ||
switch (node.kind) { | ||
case ts.SyntaxKind.Unknown: | ||
case ts.SyntaxKind.EndOfFileToken: | ||
case ts.SyntaxKind.SingleLineCommentTrivia: | ||
case ts.SyntaxKind.MultiLineCommentTrivia: | ||
case ts.SyntaxKind.NewLineTrivia: | ||
case ts.SyntaxKind.WhitespaceTrivia: | ||
case ts.SyntaxKind.ShebangTrivia: | ||
case ts.SyntaxKind.ConflictMarkerTrivia: | ||
case ts.SyntaxKind.NumericLiteral: | ||
case ts.SyntaxKind.StringLiteral: | ||
case ts.SyntaxKind.JsxText: | ||
case ts.SyntaxKind.JsxTextAllWhiteSpaces: | ||
case ts.SyntaxKind.RegularExpressionLiteral: | ||
case ts.SyntaxKind.NoSubstitutionTemplateLiteral: | ||
case ts.SyntaxKind.TemplateHead: | ||
case ts.SyntaxKind.TemplateMiddle: | ||
case ts.SyntaxKind.TemplateTail: | ||
case ts.SyntaxKind.OpenBraceToken: | ||
case ts.SyntaxKind.CloseBraceToken: | ||
case ts.SyntaxKind.OpenParenToken: | ||
case ts.SyntaxKind.CloseParenToken: | ||
case ts.SyntaxKind.OpenBracketToken: | ||
case ts.SyntaxKind.CloseBracketToken: | ||
case ts.SyntaxKind.DotToken: | ||
case ts.SyntaxKind.DotDotDotToken: | ||
case ts.SyntaxKind.SemicolonToken: | ||
case ts.SyntaxKind.CommaToken: | ||
case ts.SyntaxKind.LessThanToken: | ||
case ts.SyntaxKind.LessThanSlashToken: | ||
case ts.SyntaxKind.GreaterThanToken: | ||
case ts.SyntaxKind.LessThanEqualsToken: | ||
case ts.SyntaxKind.GreaterThanEqualsToken: | ||
case ts.SyntaxKind.EqualsEqualsToken: | ||
case ts.SyntaxKind.ExclamationEqualsToken: | ||
case ts.SyntaxKind.EqualsEqualsEqualsToken: | ||
case ts.SyntaxKind.ExclamationEqualsEqualsToken: | ||
case ts.SyntaxKind.EqualsGreaterThanToken: | ||
case ts.SyntaxKind.PlusToken: | ||
case ts.SyntaxKind.MinusToken: | ||
case ts.SyntaxKind.AsteriskToken: | ||
case ts.SyntaxKind.AsteriskAsteriskToken: | ||
case ts.SyntaxKind.SlashToken: | ||
case ts.SyntaxKind.PercentToken: | ||
case ts.SyntaxKind.PlusPlusToken: | ||
case ts.SyntaxKind.MinusMinusToken: | ||
case ts.SyntaxKind.LessThanLessThanToken: | ||
case ts.SyntaxKind.GreaterThanGreaterThanToken: | ||
case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: | ||
case ts.SyntaxKind.AmpersandToken: | ||
case ts.SyntaxKind.BarToken: | ||
case ts.SyntaxKind.CaretToken: | ||
case ts.SyntaxKind.ExclamationToken: | ||
case ts.SyntaxKind.TildeToken: | ||
case ts.SyntaxKind.AmpersandAmpersandToken: | ||
case ts.SyntaxKind.BarBarToken: | ||
case ts.SyntaxKind.QuestionToken: | ||
case ts.SyntaxKind.ColonToken: | ||
case ts.SyntaxKind.AtToken: | ||
case ts.SyntaxKind.EqualsToken: | ||
case ts.SyntaxKind.PlusEqualsToken: | ||
case ts.SyntaxKind.MinusEqualsToken: | ||
case ts.SyntaxKind.AsteriskEqualsToken: | ||
case ts.SyntaxKind.AsteriskAsteriskEqualsToken: | ||
case ts.SyntaxKind.SlashEqualsToken: | ||
case ts.SyntaxKind.PercentEqualsToken: | ||
case ts.SyntaxKind.LessThanLessThanEqualsToken: | ||
case ts.SyntaxKind.GreaterThanGreaterThanEqualsToken: | ||
case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: | ||
case ts.SyntaxKind.AmpersandEqualsToken: | ||
case ts.SyntaxKind.BarEqualsToken: | ||
case ts.SyntaxKind.CaretEqualsToken: | ||
break; | ||
case ts.SyntaxKind.Identifier: | ||
collectData(node, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.BreakKeyword: | ||
case ts.SyntaxKind.CaseKeyword: | ||
case ts.SyntaxKind.CatchKeyword: | ||
case ts.SyntaxKind.ClassKeyword: | ||
case ts.SyntaxKind.ConstKeyword: | ||
case ts.SyntaxKind.ContinueKeyword: | ||
case ts.SyntaxKind.DebuggerKeyword: | ||
case ts.SyntaxKind.DefaultKeyword: | ||
case ts.SyntaxKind.DeleteKeyword: | ||
case ts.SyntaxKind.DoKeyword: | ||
case ts.SyntaxKind.ElseKeyword: | ||
case ts.SyntaxKind.EnumKeyword: | ||
case ts.SyntaxKind.ExportKeyword: | ||
case ts.SyntaxKind.ExtendsKeyword: | ||
case ts.SyntaxKind.FalseKeyword: | ||
case ts.SyntaxKind.FinallyKeyword: | ||
case ts.SyntaxKind.ForKeyword: | ||
case ts.SyntaxKind.FunctionKeyword: | ||
case ts.SyntaxKind.IfKeyword: | ||
case ts.SyntaxKind.ImportKeyword: | ||
case ts.SyntaxKind.InKeyword: | ||
case ts.SyntaxKind.InstanceOfKeyword: | ||
case ts.SyntaxKind.NewKeyword: | ||
case ts.SyntaxKind.NullKeyword: | ||
case ts.SyntaxKind.ReturnKeyword: | ||
case ts.SyntaxKind.SuperKeyword: | ||
case ts.SyntaxKind.SwitchKeyword: | ||
break; | ||
case ts.SyntaxKind.ThisKeyword: | ||
collectData(node, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ThrowKeyword: | ||
case ts.SyntaxKind.TrueKeyword: | ||
case ts.SyntaxKind.TryKeyword: | ||
case ts.SyntaxKind.TypeOfKeyword: | ||
case ts.SyntaxKind.VarKeyword: | ||
case ts.SyntaxKind.VoidKeyword: | ||
case ts.SyntaxKind.WhileKeyword: | ||
case ts.SyntaxKind.WithKeyword: | ||
case ts.SyntaxKind.ImplementsKeyword: | ||
case ts.SyntaxKind.InterfaceKeyword: | ||
case ts.SyntaxKind.LetKeyword: | ||
case ts.SyntaxKind.PackageKeyword: | ||
case ts.SyntaxKind.PrivateKeyword: | ||
case ts.SyntaxKind.ProtectedKeyword: | ||
case ts.SyntaxKind.PublicKeyword: | ||
case ts.SyntaxKind.StaticKeyword: | ||
case ts.SyntaxKind.YieldKeyword: | ||
case ts.SyntaxKind.AbstractKeyword: | ||
case ts.SyntaxKind.AsKeyword: | ||
case ts.SyntaxKind.AnyKeyword: | ||
case ts.SyntaxKind.AsyncKeyword: | ||
case ts.SyntaxKind.AwaitKeyword: | ||
case ts.SyntaxKind.BooleanKeyword: | ||
case ts.SyntaxKind.ConstructorKeyword: | ||
case ts.SyntaxKind.DeclareKeyword: | ||
case ts.SyntaxKind.GetKeyword: | ||
case ts.SyntaxKind.IsKeyword: | ||
case ts.SyntaxKind.KeyOfKeyword: | ||
case ts.SyntaxKind.ModuleKeyword: | ||
case ts.SyntaxKind.NamespaceKeyword: | ||
case ts.SyntaxKind.NeverKeyword: | ||
case ts.SyntaxKind.ReadonlyKeyword: | ||
case ts.SyntaxKind.RequireKeyword: | ||
case ts.SyntaxKind.NumberKeyword: | ||
case ts.SyntaxKind.ObjectKeyword: | ||
case ts.SyntaxKind.SetKeyword: | ||
case ts.SyntaxKind.StringKeyword: | ||
case ts.SyntaxKind.SymbolKeyword: | ||
case ts.SyntaxKind.TypeKeyword: | ||
case ts.SyntaxKind.UndefinedKeyword: | ||
case ts.SyntaxKind.FromKeyword: | ||
case ts.SyntaxKind.GlobalKeyword: | ||
case ts.SyntaxKind.OfKeyword: | ||
break; | ||
case ts.SyntaxKind.QualifiedName: | ||
const qualifiedName = node; | ||
handleNode(qualifiedName.left, file, sourceFile); | ||
handleNode(qualifiedName.right, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ComputedPropertyName: | ||
const computedPropertyName = node; | ||
handleNode(computedPropertyName.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TypeParameter: | ||
const typeParameterDeclaration = node; | ||
handleNode(typeParameterDeclaration.name, file, sourceFile); | ||
handleNode(typeParameterDeclaration.default, file, sourceFile); | ||
handleNode(typeParameterDeclaration.expression, file, sourceFile); | ||
handleNode(typeParameterDeclaration.constraint, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.Parameter: | ||
const parameterDeclaration = node; | ||
handleNode(parameterDeclaration.dotDotDotToken, file, sourceFile); | ||
handleNode(parameterDeclaration.name, file, sourceFile); | ||
handleNode(parameterDeclaration.initializer, file, sourceFile); | ||
handleNode(parameterDeclaration.type, file, sourceFile); | ||
handleNode(parameterDeclaration.questionToken, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.Decorator: | ||
const decorator = node; | ||
handleNode(decorator.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.PropertySignature: | ||
const propertySignature = node; | ||
handleNode(propertySignature.name, file, sourceFile); | ||
handleNode(propertySignature.questionToken, file, sourceFile); | ||
handleNode(propertySignature.type, file, sourceFile); | ||
handleNode(propertySignature.initializer, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.PropertyDeclaration: | ||
const propertyDeclaration = node; | ||
handleNode(propertyDeclaration.name, file, sourceFile); | ||
handleNode(propertyDeclaration.initializer, file, sourceFile); | ||
handleNode(propertyDeclaration.type, file, sourceFile); | ||
handleNode(propertyDeclaration.questionToken, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.MethodSignature: | ||
const methodSignature = node; | ||
handleNode(methodSignature.name, file, sourceFile); | ||
handleNodes(methodSignature.parameters, file, sourceFile); | ||
handleNode(methodSignature.questionToken, file, sourceFile); | ||
handleNode(methodSignature.type, file, sourceFile); | ||
handleNodes(methodSignature.typeParameters, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.MethodDeclaration: | ||
case ts.SyntaxKind.Constructor: | ||
case ts.SyntaxKind.GetAccessor: | ||
case ts.SyntaxKind.SetAccessor: | ||
const functionLikeDeclarationBase = node; | ||
handleNode(functionLikeDeclarationBase.name, file, sourceFile); | ||
handleNodes(functionLikeDeclarationBase.parameters, file, sourceFile); | ||
handleNode(functionLikeDeclarationBase.body, file, sourceFile); | ||
handleNode(functionLikeDeclarationBase.asteriskToken, file, sourceFile); | ||
handleNode(functionLikeDeclarationBase.questionToken, file, sourceFile); | ||
handleNode(functionLikeDeclarationBase.type, file, sourceFile); | ||
handleNodes(functionLikeDeclarationBase.typeParameters, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.CallSignature: | ||
const callSignatureDeclaration = node; | ||
handleNode(callSignatureDeclaration.name, file, sourceFile); | ||
handleNodes(callSignatureDeclaration.parameters, file, sourceFile); | ||
handleNode(callSignatureDeclaration.questionToken, file, sourceFile); | ||
handleNode(callSignatureDeclaration.type, file, sourceFile); | ||
handleNodes(callSignatureDeclaration.typeParameters, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ConstructSignature: | ||
const constructSignatureDeclaration = node; | ||
handleNode(constructSignatureDeclaration.name, file, sourceFile); | ||
handleNodes(constructSignatureDeclaration.parameters, file, sourceFile); | ||
handleNode(constructSignatureDeclaration.questionToken, file, sourceFile); | ||
handleNode(constructSignatureDeclaration.type, file, sourceFile); | ||
handleNodes(constructSignatureDeclaration.typeParameters, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.IndexSignature: | ||
const indexSignatureDeclaration = node; | ||
handleNode(indexSignatureDeclaration.name, file, sourceFile); | ||
handleNodes(indexSignatureDeclaration.parameters, file, sourceFile); | ||
handleNode(indexSignatureDeclaration.questionToken, file, sourceFile); | ||
handleNode(indexSignatureDeclaration.type, file, sourceFile); | ||
handleNodes(indexSignatureDeclaration.typeParameters, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TypePredicate: | ||
const typePredicateNode = node; | ||
handleNode(typePredicateNode.type, file, sourceFile); | ||
handleNode(typePredicateNode.parameterName, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TypeReference: | ||
const typeReferenceNode = node; | ||
handleNode(typeReferenceNode.typeName, file, sourceFile); | ||
handleNodes(typeReferenceNode.typeArguments, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.FunctionType: | ||
case ts.SyntaxKind.ConstructorType: | ||
const signatureDeclarationBase = node; | ||
handleNode(signatureDeclarationBase.name, file, sourceFile); | ||
handleNodes(signatureDeclarationBase.parameters, file, sourceFile); | ||
handleNode(signatureDeclarationBase.type, file, sourceFile); | ||
handleNodes(signatureDeclarationBase.typeParameters, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TypeQuery: | ||
const typeQueryNode = node; | ||
handleNode(typeQueryNode.exprName, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TypeLiteral: | ||
const typeLiteralNode = node; | ||
handleNodes(typeLiteralNode.members, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ArrayType: | ||
const arrayTypeNode = node; | ||
handleNode(arrayTypeNode.elementType, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TupleType: | ||
const tupleTypeNode = node; | ||
handleNodes(tupleTypeNode.elementTypes, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.UnionType: | ||
const unionTypeNode = node; | ||
handleNodes(unionTypeNode.types, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.IntersectionType: | ||
const intersectionTypeNode = node; | ||
handleNodes(intersectionTypeNode.types, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ParenthesizedType: | ||
const parenthesizedTypeNode = node; | ||
handleNode(parenthesizedTypeNode.type, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ThisType: | ||
break; | ||
case ts.SyntaxKind.TypeOperator: | ||
const typeOperatorNode = node; | ||
handleNode(typeOperatorNode.type, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.IndexedAccessType: | ||
const indexedAccessTypeNode = node; | ||
handleNode(indexedAccessTypeNode.objectType, file, sourceFile); | ||
handleNode(indexedAccessTypeNode.indexType, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.MappedType: | ||
const mappedTypeNode = node; | ||
handleNode(mappedTypeNode.questionToken, file, sourceFile); | ||
handleNode(mappedTypeNode.readonlyToken, file, sourceFile); | ||
handleNode(mappedTypeNode.type, file, sourceFile); | ||
handleNode(mappedTypeNode.typeParameter, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.LiteralType: | ||
const literalTypeNode = node; | ||
handleNode(literalTypeNode.literal, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ObjectBindingPattern: | ||
const objectBindingPattern = node; | ||
handleNodes(objectBindingPattern.elements, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ArrayBindingPattern: | ||
const arrayBindingPattern = node; | ||
handleNodes(arrayBindingPattern.elements, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.BindingElement: | ||
const bindingElement = node; | ||
handleNode(bindingElement.name, file, sourceFile); | ||
handleNode(bindingElement.initializer, file, sourceFile); | ||
} | ||
handleNode(bindingElement.dotDotDotToken, file, sourceFile); | ||
handleNode(bindingElement.propertyName, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ArrayLiteralExpression: | ||
const arrayLiteralExpression = node; | ||
handleNodes(arrayLiteralExpression.elements, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ObjectLiteralExpression: | ||
const objectLiteralExpression = node; | ||
handleNodes(objectLiteralExpression.properties, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.PropertyAccessExpression: | ||
const propertyAccessExpression = node; | ||
handleNode(propertyAccessExpression.expression, file, sourceFile); | ||
handleNode(propertyAccessExpression.name, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ElementAccessExpression: | ||
const elementAccessExpression = node; | ||
handleNode(elementAccessExpression.expression, file, sourceFile); | ||
handleNode(elementAccessExpression.argumentExpression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.CallExpression: | ||
const callExpression = node; | ||
handleNode(callExpression.expression, file, sourceFile); | ||
handleNodes(callExpression.arguments, file, sourceFile); | ||
handleNodes(callExpression.typeArguments, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.NewExpression: | ||
const newExpression = node; | ||
handleNode(newExpression.expression, file, sourceFile); | ||
handleNodes(newExpression.arguments, file, sourceFile); | ||
handleNodes(newExpression.typeArguments, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TaggedTemplateExpression: | ||
const taggedTemplateExpression = node; | ||
handleNode(taggedTemplateExpression.template, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TypeAssertionExpression: | ||
const typeAssertion = node; | ||
handleNode(typeAssertion.expression, file, sourceFile); | ||
handleNode(typeAssertion.type, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ParenthesizedExpression: | ||
const parenthesizedExpression = node; | ||
handleNode(parenthesizedExpression.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.FunctionExpression: | ||
const functionExpression = node; | ||
handleNode(functionExpression.name, file, sourceFile); | ||
handleNodes(functionExpression.parameters, file, sourceFile); | ||
handleNode(functionExpression.body, file, sourceFile); | ||
handleNode(functionExpression.asteriskToken, file, sourceFile); | ||
handleNode(functionExpression.questionToken, file, sourceFile); | ||
handleNode(functionExpression.type, file, sourceFile); | ||
handleNodes(functionExpression.typeParameters, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ArrowFunction: | ||
const arrowFunction = node; | ||
handleNode(arrowFunction.name, file, sourceFile); | ||
handleNodes(arrowFunction.parameters, file, sourceFile); | ||
handleNode(arrowFunction.body, file, sourceFile); | ||
handleNode(arrowFunction.asteriskToken, file, sourceFile); | ||
handleNode(arrowFunction.questionToken, file, sourceFile); | ||
handleNode(arrowFunction.type, file, sourceFile); | ||
handleNodes(arrowFunction.typeParameters, file, sourceFile); | ||
handleNode(arrowFunction.equalsGreaterThanToken, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.DeleteExpression: | ||
const deleteExpression = node; | ||
handleNode(deleteExpression.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TypeOfExpression: | ||
const typeOfExpression = node; | ||
handleNode(typeOfExpression.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.VoidExpression: | ||
const voidExpression = node; | ||
handleNode(voidExpression.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.AwaitExpression: | ||
const awaitExpression = node; | ||
handleNode(awaitExpression.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.PrefixUnaryExpression: | ||
const prefixUnaryExpression = node; | ||
handleNode(prefixUnaryExpression.operand, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.PostfixUnaryExpression: | ||
const postfixUnaryExpression = node; | ||
handleNode(postfixUnaryExpression.operand, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.BinaryExpression: | ||
const binaryExpression = node; | ||
handleNode(binaryExpression.left, file, sourceFile); | ||
handleNode(binaryExpression.right, file, sourceFile); | ||
handleNode(binaryExpression.operatorToken, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ConditionalExpression: | ||
const conditionalExpression = node; | ||
handleNode(conditionalExpression.condition, file, sourceFile); | ||
handleNode(conditionalExpression.colonToken, file, sourceFile); | ||
handleNode(conditionalExpression.questionToken, file, sourceFile); | ||
handleNode(conditionalExpression.whenTrue, file, sourceFile); | ||
handleNode(conditionalExpression.whenFalse, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TemplateExpression: | ||
const templateExpression = node; | ||
handleNodes(templateExpression.templateSpans, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.YieldExpression: | ||
const yieldExpression = node; | ||
handleNode(yieldExpression.asteriskToken, file, sourceFile); | ||
handleNode(yieldExpression.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.SpreadElement: | ||
const spreadElement = node; | ||
handleNode(spreadElement.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ClassExpression: | ||
const classExpression = node; | ||
handleNode(classExpression.name, file, sourceFile); | ||
handleNodes(classExpression.typeParameters, file, sourceFile); | ||
handleNodes(classExpression.members, file, sourceFile); | ||
handleNodes(classExpression.heritageClauses, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.OmittedExpression: | ||
break; | ||
case ts.SyntaxKind.ExpressionWithTypeArguments: | ||
const expressionWithTypeArguments = node; | ||
handleNode(expressionWithTypeArguments.expression, file, sourceFile); | ||
handleNodes(expressionWithTypeArguments.typeArguments, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.AsExpression: | ||
const asExpression = node; | ||
handleNode(asExpression.expression, file, sourceFile); | ||
handleNode(asExpression.type, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.NonNullExpression: | ||
const nonNullExpression = node; | ||
handleNode(nonNullExpression.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.MetaProperty: | ||
const metaProperty = node; | ||
handleNode(metaProperty.name, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TemplateSpan: | ||
const templateSpan = node; | ||
handleNode(templateSpan.expression, file, sourceFile); | ||
handleNode(templateSpan.literal, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.SemicolonClassElement: | ||
const semicolonClassElement = node; | ||
handleNode(semicolonClassElement.name, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.Block: | ||
const block = node; | ||
handleNodes(block.statements, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.VariableStatement: | ||
const variableStatement = node; | ||
handleNode(variableStatement.declarationList, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.EmptyStatement: | ||
break; | ||
case ts.SyntaxKind.ExpressionStatement: | ||
const expressionStatement = node; | ||
handleNode(expressionStatement.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.IfStatement: | ||
const ifStatement = node; | ||
handleNode(ifStatement.expression, file, sourceFile); | ||
handleNode(ifStatement.thenStatement, file, sourceFile); | ||
handleNode(ifStatement.elseStatement, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.DoStatement: | ||
const doStatement = node; | ||
handleNode(doStatement.expression, file, sourceFile); | ||
handleNode(doStatement.statement, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.WhileStatement: | ||
const whileStatement = node; | ||
handleNode(whileStatement.statement, file, sourceFile); | ||
handleNode(whileStatement.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ForStatement: | ||
const forStatement = node; | ||
handleNode(forStatement.initializer, file, sourceFile); | ||
handleNode(forStatement.condition, file, sourceFile); | ||
handleNode(forStatement.incrementor, file, sourceFile); | ||
handleNode(forStatement.statement, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ForInStatement: | ||
const forInStatement = node; | ||
handleNode(forInStatement.initializer, file, sourceFile); | ||
handleNode(forInStatement.expression, file, sourceFile); | ||
handleNode(forInStatement.statement, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ForOfStatement: | ||
const forOfStatement = node; | ||
handleNode(forOfStatement.initializer, file, sourceFile); | ||
handleNode(forOfStatement.statement, file, sourceFile); | ||
handleNode(forOfStatement.expression, file, sourceFile); | ||
handleNode(forOfStatement.awaitModifier, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ContinueStatement: | ||
case ts.SyntaxKind.BreakStatement: | ||
break; | ||
case ts.SyntaxKind.ReturnStatement: | ||
const returnStatement = node; | ||
handleNode(returnStatement.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.WithStatement: | ||
const withStatement = node; | ||
handleNode(withStatement.expression, file, sourceFile); | ||
handleNode(withStatement.statement, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.SwitchStatement: | ||
const switchStatement = node; | ||
handleNode(switchStatement.expression, file, sourceFile); | ||
handleNode(switchStatement.caseBlock, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.LabeledStatement: | ||
const labeledStatement = node; | ||
handleNode(labeledStatement.label, file, sourceFile); | ||
handleNode(labeledStatement.statement, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ThrowStatement: | ||
const throwStatement = node; | ||
handleNode(throwStatement.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TryStatement: | ||
const tryStatement = node; | ||
handleNode(tryStatement.tryBlock, file, sourceFile); | ||
handleNode(tryStatement.catchClause, file, sourceFile); | ||
handleNode(tryStatement.finallyBlock, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.DebuggerStatement: | ||
break; | ||
case ts.SyntaxKind.VariableDeclaration: | ||
const variableDeclaration = node; | ||
handleNode(variableDeclaration.name, file, sourceFile); | ||
handleNode(variableDeclaration.type, file, sourceFile); | ||
handleNode(variableDeclaration.initializer, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.VariableDeclarationList: | ||
const declarationList = node; | ||
handleNodes(declarationList.declarations, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.FunctionDeclaration: | ||
const functionDeclaration = node; | ||
handleNode(functionDeclaration.name, file, sourceFile); | ||
handleNodes(functionDeclaration.parameters, file, sourceFile); | ||
handleNode(functionDeclaration.body, file, sourceFile); | ||
handleNode(functionDeclaration.asteriskToken, file, sourceFile); | ||
handleNode(functionDeclaration.questionToken, file, sourceFile); | ||
handleNode(functionDeclaration.type, file, sourceFile); | ||
handleNodes(functionDeclaration.typeParameters, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ClassDeclaration: | ||
const classDeclaration = node; | ||
handleNode(classDeclaration.name, file, sourceFile); | ||
handleNodes(classDeclaration.members, file, sourceFile); | ||
handleNodes(classDeclaration.typeParameters, file, sourceFile); | ||
handleNodes(classDeclaration.heritageClauses, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.InterfaceDeclaration: | ||
const interfaceDeclaration = node; | ||
handleNode(interfaceDeclaration.name, file, sourceFile); | ||
handleNodes(interfaceDeclaration.members, file, sourceFile); | ||
handleNodes(interfaceDeclaration.typeParameters, file, sourceFile); | ||
handleNodes(interfaceDeclaration.heritageClauses, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.TypeAliasDeclaration: | ||
const typeAliasDeclaration = node; | ||
handleNode(typeAliasDeclaration.name, file, sourceFile); | ||
handleNode(typeAliasDeclaration.type, file, sourceFile); | ||
handleNodes(typeAliasDeclaration.typeParameters, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.EnumDeclaration: | ||
const enumDeclaration = node; | ||
handleNode(enumDeclaration.name, file, sourceFile); | ||
handleNodes(enumDeclaration.members, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ModuleDeclaration: | ||
const moduleDeclaration = node; | ||
handleNode(moduleDeclaration.name, file, sourceFile); | ||
handleNode(moduleDeclaration.body, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ModuleBlock: | ||
const moduleBlock = node; | ||
handleNodes(moduleBlock.statements, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.CaseBlock: | ||
const caseBlock = node; | ||
handleNodes(caseBlock.clauses, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.NamespaceExportDeclaration: | ||
const namespaceExportDeclaration = node; | ||
handleNode(namespaceExportDeclaration.name, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ImportEqualsDeclaration: | ||
const importEqualsDeclaration = node; | ||
handleNode(importEqualsDeclaration.name, file, sourceFile); | ||
handleNode(importEqualsDeclaration.moduleReference, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ImportDeclaration: | ||
const importDeclaration = node; | ||
handleNode(importDeclaration.importClause, file, sourceFile); | ||
handleNode(importDeclaration.moduleSpecifier, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ImportClause: | ||
const importClause = node; | ||
handleNode(importClause.name, file, sourceFile); | ||
handleNode(importClause.namedBindings, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.NamespaceImport: | ||
const namespaceImport = node; | ||
handleNode(namespaceImport.name, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.NamedImports: | ||
const namedImports = node; | ||
handleNodes(namedImports.elements, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ImportSpecifier: | ||
const importSpecifier = node; | ||
handleNode(importSpecifier.name, file, sourceFile); | ||
handleNode(importSpecifier.propertyName, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ExportAssignment: | ||
const exportAssignment = node; | ||
handleNode(exportAssignment.name, file, sourceFile); | ||
handleNode(exportAssignment.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ExportDeclaration: | ||
const exportDeclaration = node; | ||
handleNode(exportDeclaration.exportClause, file, sourceFile); | ||
handleNode(exportDeclaration.name, file, sourceFile); | ||
handleNode(exportDeclaration.moduleSpecifier, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.NamedExports: | ||
const namedExports = node; | ||
handleNodes(namedExports.elements, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ExportSpecifier: | ||
const exportSpecifier = node; | ||
handleNode(exportSpecifier.name, file, sourceFile); | ||
handleNode(exportSpecifier.propertyName, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.MissingDeclaration: | ||
const missingDeclaration = node; | ||
handleNode(missingDeclaration.name, file, sourceFile); | ||
handleNode(missingDeclaration.questionToken, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ExternalModuleReference: | ||
const externalModuleReference = node; | ||
handleNode(externalModuleReference.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.JsxElement: | ||
const jsxElement = node; | ||
handleNode(jsxElement.openingElement, file, sourceFile); | ||
handleNode(jsxElement.closingElement, file, sourceFile); | ||
handleNodes(jsxElement.children, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.JsxSelfClosingElement: | ||
const jsxSelfClosingElement = node; | ||
handleNode(jsxSelfClosingElement.attributes, file, sourceFile); | ||
handleNode(jsxSelfClosingElement.tagName, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.JsxOpeningElement: | ||
const jsxOpeningElement = node; | ||
handleNode(jsxOpeningElement.attributes, file, sourceFile); | ||
handleNode(jsxOpeningElement.tagName, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.JsxClosingElement: | ||
const jsxClosingElement = node; | ||
handleNode(jsxClosingElement.tagName, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.JsxFragment: | ||
const jsxFragment = node; | ||
handleNode(jsxFragment.openingFragment, file, sourceFile); | ||
handleNode(jsxFragment.closingFragment, file, sourceFile); | ||
handleNodes(jsxFragment.children, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.JsxOpeningFragment: | ||
break; | ||
case ts.SyntaxKind.JsxClosingFragment: | ||
break; | ||
case ts.SyntaxKind.JsxAttribute: | ||
const jsxAttribute = node; | ||
handleNode(jsxAttribute.name, file, sourceFile); | ||
handleNode(jsxAttribute.initializer, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.JsxAttributes: | ||
const jsxAttributes = node; | ||
handleNodes(jsxAttributes.properties, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.JsxSpreadAttribute: | ||
const jsxSpreadAttribute = node; | ||
handleNode(jsxSpreadAttribute.name, file, sourceFile); | ||
handleNode(jsxSpreadAttribute.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.JsxExpression: | ||
const jsxExpression = node; | ||
handleNode(jsxExpression.dotDotDotToken, file, sourceFile); | ||
handleNode(jsxExpression.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.CaseClause: | ||
const caseClause = node; | ||
handleNodes(caseClause.statements, file, sourceFile); | ||
handleNode(caseClause.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.DefaultClause: | ||
const defaultClause = node; | ||
handleNodes(defaultClause.statements, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.HeritageClause: | ||
const heritageClause = node; | ||
handleNodes(heritageClause.types, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.CatchClause: | ||
const catchClause = node; | ||
handleNode(catchClause.variableDeclaration, file, sourceFile); | ||
handleNode(catchClause.block, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.PropertyAssignment: | ||
const propertyAssignmentExpression = node; | ||
handleNode(propertyAssignmentExpression.name, file, sourceFile); | ||
handleNode(propertyAssignmentExpression.questionToken, file, sourceFile); | ||
handleNode(propertyAssignmentExpression.initializer, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.ShorthandPropertyAssignment: | ||
const shorthandPropertyAssignment = node; | ||
handleNode(shorthandPropertyAssignment.name, file, sourceFile); | ||
handleNode(shorthandPropertyAssignment.questionToken, file, sourceFile); | ||
handleNode(shorthandPropertyAssignment.equalsToken, file, sourceFile); | ||
handleNode(shorthandPropertyAssignment.objectAssignmentInitializer, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.SpreadAssignment: | ||
const spreadAssignment = node; | ||
handleNode(spreadAssignment.name, file, sourceFile); | ||
handleNode(spreadAssignment.expression, file, sourceFile); | ||
break; | ||
case ts.SyntaxKind.EnumMember: | ||
case ts.SyntaxKind.SourceFile: | ||
case ts.SyntaxKind.Bundle: | ||
case ts.SyntaxKind.JSDocTypeExpression: | ||
case ts.SyntaxKind.JSDocAllType: | ||
case ts.SyntaxKind.JSDocUnknownType: | ||
case ts.SyntaxKind.JSDocNullableType: | ||
case ts.SyntaxKind.JSDocNonNullableType: | ||
case ts.SyntaxKind.JSDocOptionalType: | ||
case ts.SyntaxKind.JSDocFunctionType: | ||
case ts.SyntaxKind.JSDocVariadicType: | ||
case ts.SyntaxKind.JSDocComment: | ||
case ts.SyntaxKind.JSDocTag: | ||
case ts.SyntaxKind.JSDocAugmentsTag: | ||
case ts.SyntaxKind.JSDocClassTag: | ||
case ts.SyntaxKind.JSDocParameterTag: | ||
case ts.SyntaxKind.JSDocReturnTag: | ||
case ts.SyntaxKind.JSDocTypeTag: | ||
case ts.SyntaxKind.JSDocTemplateTag: | ||
case ts.SyntaxKind.JSDocTypedefTag: | ||
case ts.SyntaxKind.JSDocPropertyTag: | ||
case ts.SyntaxKind.JSDocTypeLiteral: | ||
case ts.SyntaxKind.SyntaxList: | ||
case ts.SyntaxKind.NotEmittedStatement: | ||
case ts.SyntaxKind.PartiallyEmittedExpression: | ||
case ts.SyntaxKind.CommaListExpression: | ||
case ts.SyntaxKind.MergeDeclarationMarker: | ||
case ts.SyntaxKind.EndOfDeclarationMarker: | ||
case ts.SyntaxKind.Count: | ||
break; | ||
default: | ||
console.log(`warning: unhandled node kind: ${node.kind}`); | ||
} | ||
else if (node.kind === ts.SyntaxKind.Parameter) { | ||
const parameter = node; | ||
handleNode(parameter.name, file, sourceFile); | ||
if (parameter.initializer) { | ||
handleNode(parameter.initializer, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.ImportDeclaration) { | ||
const importDeclaration = node; | ||
if (importDeclaration.importClause) { | ||
handleNode(importDeclaration.importClause.name, file, sourceFile); | ||
handleNode(importDeclaration.importClause.namedBindings, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.NamespaceImport) { | ||
const namespaceImport = node; | ||
handleNode(namespaceImport.name, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.MethodDeclaration) { | ||
const methodDeclaration = node; | ||
for (const parameter of methodDeclaration.parameters) { | ||
handleNode(parameter, file, sourceFile); | ||
} | ||
handleNode(methodDeclaration.body, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ClassDeclaration) { | ||
const classDeclaration = node; | ||
handleNode(classDeclaration.name, file, sourceFile); | ||
for (const member of classDeclaration.members) { | ||
handleNode(member, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.ImportEqualsDeclaration) { | ||
const importEqualsDeclaration = node; | ||
handleNode(importEqualsDeclaration.name, file, sourceFile); | ||
handleNode(importEqualsDeclaration.moduleReference, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ThisKeyword) { | ||
const thisExpression = node; | ||
collectData(thisExpression, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ShorthandPropertyAssignment) { | ||
const shorthandPropertyAssignment = node; | ||
handleNode(shorthandPropertyAssignment.name, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.NamedImports) { | ||
const namedImports = node; | ||
for (const element of namedImports.elements) { | ||
handleNode(element, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.ImportSpecifier) { | ||
const importSpecifier = node; | ||
handleNode(importSpecifier.name, file, sourceFile); | ||
handleNode(importSpecifier.propertyName, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.PropertyDeclaration) { | ||
const propertyDeclaration = node; | ||
handleNode(propertyDeclaration.name, file, sourceFile); | ||
handleNode(propertyDeclaration.initializer, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.GetAccessor) { | ||
const getAccessorDeclaration = node; | ||
handleNode(getAccessorDeclaration.name, file, sourceFile); | ||
for (const parameter of getAccessorDeclaration.parameters) { | ||
handleNode(parameter, file, sourceFile); | ||
} | ||
handleNode(getAccessorDeclaration.body, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.Constructor) { | ||
const constructorDeclaration = node; | ||
handleNode(constructorDeclaration.name, file, sourceFile); | ||
for (const parameter of constructorDeclaration.parameters) { | ||
handleNode(parameter, file, sourceFile); | ||
} | ||
handleNode(constructorDeclaration.body, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.NamespaceExportDeclaration) { | ||
const namespaceExportDeclaration = node; | ||
handleNode(namespaceExportDeclaration.name, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.QualifiedName) { | ||
const qualifiedName = node; | ||
handleNode(qualifiedName.left, file, sourceFile); | ||
handleNode(qualifiedName.right, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.ArrayBindingPattern) { | ||
const arrayBindingPattern = node; | ||
for (const element of arrayBindingPattern.elements) { | ||
handleNode(element, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.ExternalModuleReference) { | ||
const externalModuleReference = node; | ||
handleNode(externalModuleReference.expression, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.SpreadAssignment) { | ||
const spreadAssignment = node; | ||
handleNode(spreadAssignment.name, file, sourceFile); | ||
handleNode(spreadAssignment.expression, file, sourceFile); | ||
} | ||
else if (node.kind === ts.SyntaxKind.IndexSignature) { | ||
const indexSignatureDeclaration = node; | ||
handleNode(indexSignatureDeclaration.name, file, sourceFile); | ||
for (const parameter of indexSignatureDeclaration.parameters) { | ||
handleNode(parameter, file, sourceFile); | ||
} | ||
} | ||
else if (node.kind === ts.SyntaxKind.EndOfFileToken | ||
|| node.kind === ts.SyntaxKind.NumericLiteral | ||
|| node.kind === ts.SyntaxKind.StringLiteral | ||
|| node.kind === ts.SyntaxKind.InterfaceDeclaration | ||
|| node.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral | ||
|| node.kind === ts.SyntaxKind.EnumDeclaration | ||
|| node.kind === ts.SyntaxKind.TypeAliasDeclaration | ||
|| node.kind === ts.SyntaxKind.NullKeyword | ||
|| node.kind === ts.SyntaxKind.FalseKeyword | ||
|| node.kind === ts.SyntaxKind.TrueKeyword | ||
|| node.kind === ts.SyntaxKind.EmptyStatement | ||
|| node.kind === ts.SyntaxKind.BreakStatement | ||
|| node.kind === ts.SyntaxKind.ContinueStatement | ||
|| node.kind === ts.SyntaxKind.RegularExpressionLiteral) { | ||
// do nothing | ||
} | ||
else { | ||
console.log(`warning: unhandled node kind: ${node.kind}`); | ||
} | ||
} | ||
@@ -428,0 +906,0 @@ for (const file of rootNames) { |
{ | ||
"name": "type-coverage", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A CLI tool to check type coverage for typescript code", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50104
929
1