type-coverage-core
Advanced tools
Comparing version 2.8.2 to 2.8.3
1497
dist/checker.js
@@ -31,6 +31,14 @@ "use strict"; | ||
function collectData(node, context) { | ||
const types = []; | ||
const type = context.checker.getTypeAtLocation(node); | ||
if (type) { | ||
types.push(type); | ||
} | ||
const contextualType = context.checker.getContextualType(node); | ||
if (contextualType) { | ||
types.push(contextualType); | ||
} | ||
if (types.length > 0) { | ||
context.typeCheckResult.totalCount++; | ||
if (typeIsStrictAny(type, context.strict)) { | ||
if (types.every((t) => typeIsStrictAny(t, context.strict))) { | ||
const success = collectAny(node, context); | ||
@@ -94,842 +102,657 @@ if (!success) { | ||
checkNodes(node.modifiers, context); | ||
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.QuestionQuestionToken: | ||
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: | ||
const id = node; | ||
if (context.catchVariables[id.escapedText]) { | ||
return; | ||
} | ||
collectData(node, context); | ||
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, context); | ||
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; | ||
checkNode(qualifiedName.left, context); | ||
checkNode(qualifiedName.right, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ComputedPropertyName: | ||
const computedPropertyName = node; | ||
checkNode(computedPropertyName.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TypeParameter: | ||
const typeParameterDeclaration = node; | ||
checkNode(typeParameterDeclaration.name, context); | ||
checkNode(typeParameterDeclaration.default, context); | ||
checkNode(typeParameterDeclaration.expression, context); | ||
checkNode(typeParameterDeclaration.constraint, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.Parameter: | ||
const parameterDeclaration = node; | ||
checkNode(parameterDeclaration.dotDotDotToken, context); | ||
checkNode(parameterDeclaration.name, context); | ||
checkNode(parameterDeclaration.initializer, context); | ||
checkNode(parameterDeclaration.type, context); | ||
checkNode(parameterDeclaration.questionToken, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.Decorator: | ||
const decorator = node; | ||
checkNode(decorator.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.PropertySignature: | ||
const propertySignature = node; | ||
checkNode(propertySignature.name, context); | ||
checkNode(propertySignature.questionToken, context); | ||
checkNode(propertySignature.type, context); | ||
checkNode(propertySignature.initializer, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.PropertyDeclaration: | ||
const propertyDeclaration = node; | ||
checkNode(propertyDeclaration.name, context); | ||
checkNode(propertyDeclaration.initializer, context); | ||
checkNode(propertyDeclaration.type, context); | ||
checkNode(propertyDeclaration.questionToken, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.MethodSignature: | ||
const methodSignature = node; | ||
checkNode(methodSignature.name, context); | ||
checkNodes(methodSignature.parameters, context); | ||
checkNode(methodSignature.questionToken, context); | ||
checkNode(methodSignature.type, context); | ||
checkNodes(methodSignature.typeParameters, context); | ||
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; | ||
checkNode(functionLikeDeclarationBase.name, context); | ||
checkNodes(functionLikeDeclarationBase.parameters, context); | ||
checkNode(functionLikeDeclarationBase.body, context); | ||
checkNode(functionLikeDeclarationBase.asteriskToken, context); | ||
checkNode(functionLikeDeclarationBase.questionToken, context); | ||
checkNode(functionLikeDeclarationBase.type, context); | ||
checkNodes(functionLikeDeclarationBase.typeParameters, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.CallSignature: | ||
const callSignatureDeclaration = node; | ||
checkNode(callSignatureDeclaration.name, context); | ||
checkNodes(callSignatureDeclaration.parameters, context); | ||
checkNode(callSignatureDeclaration.questionToken, context); | ||
checkNode(callSignatureDeclaration.type, context); | ||
checkNodes(callSignatureDeclaration.typeParameters, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ConstructSignature: | ||
const constructSignatureDeclaration = node; | ||
checkNode(constructSignatureDeclaration.name, context); | ||
checkNodes(constructSignatureDeclaration.parameters, context); | ||
checkNode(constructSignatureDeclaration.questionToken, context); | ||
checkNode(constructSignatureDeclaration.type, context); | ||
checkNodes(constructSignatureDeclaration.typeParameters, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.IndexSignature: | ||
const indexSignatureDeclaration = node; | ||
checkNode(indexSignatureDeclaration.name, context); | ||
checkNodes(indexSignatureDeclaration.parameters, context); | ||
checkNode(indexSignatureDeclaration.questionToken, context); | ||
checkNode(indexSignatureDeclaration.type, context); | ||
checkNodes(indexSignatureDeclaration.typeParameters, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TypePredicate: | ||
const typePredicateNode = node; | ||
checkNode(typePredicateNode.type, context); | ||
checkNode(typePredicateNode.parameterName, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TypeReference: | ||
const typeReferenceNode = node; | ||
checkNode(typeReferenceNode.typeName, context); | ||
checkNodes(typeReferenceNode.typeArguments, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.FunctionType: | ||
case typescript_1.default.SyntaxKind.ConstructorType: | ||
const signatureDeclarationBase = node; | ||
checkNode(signatureDeclarationBase.name, context); | ||
checkNodes(signatureDeclarationBase.parameters, context); | ||
checkNode(signatureDeclarationBase.type, context); | ||
checkNodes(signatureDeclarationBase.typeParameters, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TypeQuery: | ||
const typeQueryNode = node; | ||
checkNode(typeQueryNode.exprName, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TypeLiteral: | ||
const typeLiteralNode = node; | ||
checkNodes(typeLiteralNode.members, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ArrayType: | ||
const arrayTypeNode = node; | ||
checkNode(arrayTypeNode.elementType, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TupleType: | ||
const tupleTypeNode = node; | ||
checkNodes(tupleTypeNode.elementTypes, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.OptionalType: | ||
break; | ||
case typescript_1.default.SyntaxKind.RestType: | ||
const restTypeNode = node; | ||
checkNode(restTypeNode.type, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.UnionType: | ||
const unionTypeNode = node; | ||
checkNodes(unionTypeNode.types, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.IntersectionType: | ||
const intersectionTypeNode = node; | ||
checkNodes(intersectionTypeNode.types, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ConditionalType: | ||
const conditionalTypeNode = node; | ||
checkNode(conditionalTypeNode.checkType, context); | ||
checkNode(conditionalTypeNode.extendsType, context); | ||
checkNode(conditionalTypeNode.trueType, context); | ||
checkNode(conditionalTypeNode.falseType, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.InferType: | ||
const inferTypeNode = node; | ||
checkNode(inferTypeNode.typeParameter, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ParenthesizedType: | ||
const parenthesizedTypeNode = node; | ||
checkNode(parenthesizedTypeNode.type, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ThisType: | ||
break; | ||
case typescript_1.default.SyntaxKind.TypeOperator: | ||
const typeOperatorNode = node; | ||
checkNode(typeOperatorNode.type, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.IndexedAccessType: | ||
const indexedAccessTypeNode = node; | ||
checkNode(indexedAccessTypeNode.objectType, context); | ||
checkNode(indexedAccessTypeNode.indexType, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.MappedType: | ||
const mappedTypeNode = node; | ||
checkNode(mappedTypeNode.questionToken, context); | ||
checkNode(mappedTypeNode.readonlyToken, context); | ||
checkNode(mappedTypeNode.type, context); | ||
checkNode(mappedTypeNode.typeParameter, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.LiteralType: | ||
const literalTypeNode = node; | ||
checkNode(literalTypeNode.literal, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ImportType: | ||
const importTypeNode = node; | ||
checkNode(importTypeNode.qualifier, context); | ||
checkNode(importTypeNode.argument, context); | ||
checkNodes(importTypeNode.typeArguments, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ObjectBindingPattern: | ||
const objectBindingPattern = node; | ||
checkNodes(objectBindingPattern.elements, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ArrayBindingPattern: | ||
const arrayBindingPattern = node; | ||
checkNodes(arrayBindingPattern.elements, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.BindingElement: | ||
const bindingElement = node; | ||
checkNode(bindingElement.name, context); | ||
checkNode(bindingElement.initializer, context); | ||
checkNode(bindingElement.dotDotDotToken, context); | ||
checkNode(bindingElement.propertyName, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ArrayLiteralExpression: | ||
const arrayLiteralExpression = node; | ||
checkNodes(arrayLiteralExpression.elements, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ObjectLiteralExpression: | ||
const objectLiteralExpression = node; | ||
checkNodes(objectLiteralExpression.properties, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.PropertyAccessExpression: | ||
const propertyAccessExpression = node; | ||
checkNode(propertyAccessExpression.expression, context); | ||
checkNode(propertyAccessExpression.name, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ElementAccessExpression: | ||
const elementAccessExpression = node; | ||
checkNode(elementAccessExpression.expression, context); | ||
checkNode(elementAccessExpression.argumentExpression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.CallExpression: | ||
const callExpression = node; | ||
checkNode(callExpression.expression, context); | ||
checkNodes(callExpression.arguments, context); | ||
checkNodes(callExpression.typeArguments, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.NewExpression: | ||
const newExpression = node; | ||
checkNode(newExpression.expression, context); | ||
checkNodes(newExpression.arguments, context); | ||
checkNodes(newExpression.typeArguments, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TaggedTemplateExpression: | ||
const taggedTemplateExpression = node; | ||
checkNode(taggedTemplateExpression.template, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TypeAssertionExpression: | ||
const typeAssertion = node; | ||
checkTypeAssertion(typeAssertion, context); | ||
checkNode(typeAssertion.expression, context); | ||
checkNode(typeAssertion.type, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ParenthesizedExpression: | ||
const parenthesizedExpression = node; | ||
checkNode(parenthesizedExpression.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.FunctionExpression: | ||
const functionExpression = node; | ||
checkNode(functionExpression.name, context); | ||
checkNodes(functionExpression.parameters, context); | ||
checkNode(functionExpression.body, context); | ||
checkNode(functionExpression.asteriskToken, context); | ||
checkNode(functionExpression.questionToken, context); | ||
checkNode(functionExpression.type, context); | ||
checkNodes(functionExpression.typeParameters, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ArrowFunction: | ||
const arrowFunction = node; | ||
checkNode(arrowFunction.name, context); | ||
checkNodes(arrowFunction.parameters, context); | ||
checkNode(arrowFunction.body, context); | ||
checkNode(arrowFunction.asteriskToken, context); | ||
checkNode(arrowFunction.questionToken, context); | ||
checkNode(arrowFunction.type, context); | ||
checkNodes(arrowFunction.typeParameters, context); | ||
checkNode(arrowFunction.equalsGreaterThanToken, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.DeleteExpression: | ||
const deleteExpression = node; | ||
checkNode(deleteExpression.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TypeOfExpression: | ||
const typeOfExpression = node; | ||
checkNode(typeOfExpression.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.VoidExpression: | ||
const voidExpression = node; | ||
checkNode(voidExpression.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.AwaitExpression: | ||
const awaitExpression = node; | ||
checkNode(awaitExpression.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.PrefixUnaryExpression: | ||
const prefixUnaryExpression = node; | ||
checkNode(prefixUnaryExpression.operand, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.PostfixUnaryExpression: | ||
const postfixUnaryExpression = node; | ||
checkNode(postfixUnaryExpression.operand, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.BinaryExpression: | ||
const binaryExpression = node; | ||
checkNode(binaryExpression.left, context); | ||
checkNode(binaryExpression.right, context); | ||
checkNode(binaryExpression.operatorToken, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ConditionalExpression: | ||
const conditionalExpression = node; | ||
checkNode(conditionalExpression.condition, context); | ||
checkNode(conditionalExpression.colonToken, context); | ||
checkNode(conditionalExpression.questionToken, context); | ||
checkNode(conditionalExpression.whenTrue, context); | ||
checkNode(conditionalExpression.whenFalse, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TemplateExpression: | ||
const templateExpression = node; | ||
checkNodes(templateExpression.templateSpans, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.YieldExpression: | ||
const yieldExpression = node; | ||
checkNode(yieldExpression.asteriskToken, context); | ||
checkNode(yieldExpression.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.SpreadElement: | ||
const spreadElement = node; | ||
checkNode(spreadElement.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ClassExpression: | ||
const classExpression = node; | ||
checkNode(classExpression.name, context); | ||
checkNodes(classExpression.typeParameters, context); | ||
checkNodes(classExpression.members, context); | ||
checkNodes(classExpression.heritageClauses, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.OmittedExpression: | ||
break; | ||
case typescript_1.default.SyntaxKind.ExpressionWithTypeArguments: | ||
const expressionWithTypeArguments = node; | ||
checkNode(expressionWithTypeArguments.expression, context); | ||
checkNodes(expressionWithTypeArguments.typeArguments, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.AsExpression: | ||
const asExpression = node; | ||
checkTypeAssertion(asExpression, context); | ||
checkNode(asExpression.expression, context); | ||
checkNode(asExpression.type, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.NonNullExpression: | ||
const nonNullExpression = node; | ||
checkTypeAssertion(nonNullExpression, context); | ||
checkNode(nonNullExpression.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.MetaProperty: | ||
const metaProperty = node; | ||
checkNode(metaProperty.name, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TemplateSpan: | ||
const templateSpan = node; | ||
checkNode(templateSpan.expression, context); | ||
checkNode(templateSpan.literal, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.SemicolonClassElement: | ||
const semicolonClassElement = node; | ||
checkNode(semicolonClassElement.name, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.Block: | ||
const block = node; | ||
checkNodes(block.statements, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.VariableStatement: | ||
const variableStatement = node; | ||
checkNode(variableStatement.declarationList, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.EmptyStatement: | ||
break; | ||
case typescript_1.default.SyntaxKind.ExpressionStatement: | ||
const expressionStatement = node; | ||
checkNode(expressionStatement.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.IfStatement: | ||
const ifStatement = node; | ||
checkNode(ifStatement.expression, context); | ||
checkNode(ifStatement.thenStatement, context); | ||
checkNode(ifStatement.elseStatement, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.DoStatement: | ||
const doStatement = node; | ||
checkNode(doStatement.expression, context); | ||
checkNode(doStatement.statement, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.WhileStatement: | ||
const whileStatement = node; | ||
checkNode(whileStatement.statement, context); | ||
checkNode(whileStatement.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ForStatement: | ||
const forStatement = node; | ||
checkNode(forStatement.initializer, context); | ||
checkNode(forStatement.condition, context); | ||
checkNode(forStatement.incrementor, context); | ||
checkNode(forStatement.statement, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ForInStatement: | ||
const forInStatement = node; | ||
checkNode(forInStatement.initializer, context); | ||
checkNode(forInStatement.expression, context); | ||
checkNode(forInStatement.statement, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ForOfStatement: | ||
const forOfStatement = node; | ||
checkNode(forOfStatement.initializer, context); | ||
checkNode(forOfStatement.statement, context); | ||
checkNode(forOfStatement.expression, context); | ||
checkNode(forOfStatement.awaitModifier, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ContinueStatement: | ||
case typescript_1.default.SyntaxKind.BreakStatement: | ||
break; | ||
case typescript_1.default.SyntaxKind.ReturnStatement: | ||
const returnStatement = node; | ||
checkNode(returnStatement.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.WithStatement: | ||
const withStatement = node; | ||
checkNode(withStatement.expression, context); | ||
checkNode(withStatement.statement, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.SwitchStatement: | ||
const switchStatement = node; | ||
checkNode(switchStatement.expression, context); | ||
checkNode(switchStatement.caseBlock, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.LabeledStatement: | ||
const labeledStatement = node; | ||
checkNode(labeledStatement.label, context); | ||
checkNode(labeledStatement.statement, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ThrowStatement: | ||
const throwStatement = node; | ||
checkNode(throwStatement.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TryStatement: | ||
const tryStatement = node; | ||
checkNode(tryStatement.tryBlock, context); | ||
checkNode(tryStatement.catchClause, context); | ||
checkNode(tryStatement.finallyBlock, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.DebuggerStatement: | ||
break; | ||
case typescript_1.default.SyntaxKind.VariableDeclaration: | ||
const variableDeclaration = node; | ||
checkNode(variableDeclaration.name, context); | ||
checkNode(variableDeclaration.type, context); | ||
checkNode(variableDeclaration.initializer, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.VariableDeclarationList: | ||
const declarationList = node; | ||
checkNodes(declarationList.declarations, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.FunctionDeclaration: | ||
const functionDeclaration = node; | ||
checkNode(functionDeclaration.name, context); | ||
checkNodes(functionDeclaration.parameters, context); | ||
checkNode(functionDeclaration.body, context); | ||
checkNode(functionDeclaration.asteriskToken, context); | ||
checkNode(functionDeclaration.questionToken, context); | ||
checkNode(functionDeclaration.type, context); | ||
checkNodes(functionDeclaration.typeParameters, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ClassDeclaration: | ||
const classDeclaration = node; | ||
checkNode(classDeclaration.name, context); | ||
checkNodes(classDeclaration.members, context); | ||
checkNodes(classDeclaration.typeParameters, context); | ||
checkNodes(classDeclaration.heritageClauses, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.InterfaceDeclaration: | ||
const interfaceDeclaration = node; | ||
checkNode(interfaceDeclaration.name, context); | ||
checkNodes(interfaceDeclaration.members, context); | ||
checkNodes(interfaceDeclaration.typeParameters, context); | ||
checkNodes(interfaceDeclaration.heritageClauses, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.TypeAliasDeclaration: | ||
const typeAliasDeclaration = node; | ||
checkNode(typeAliasDeclaration.name, context); | ||
checkNode(typeAliasDeclaration.type, context); | ||
checkNodes(typeAliasDeclaration.typeParameters, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.EnumDeclaration: | ||
const enumDeclaration = node; | ||
checkNode(enumDeclaration.name, context); | ||
checkNodes(enumDeclaration.members, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ModuleDeclaration: | ||
const moduleDeclaration = node; | ||
checkNode(moduleDeclaration.name, context); | ||
checkNode(moduleDeclaration.body, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ModuleBlock: | ||
const moduleBlock = node; | ||
checkNodes(moduleBlock.statements, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.CaseBlock: | ||
const caseBlock = node; | ||
checkNodes(caseBlock.clauses, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.NamespaceExportDeclaration: | ||
const namespaceExportDeclaration = node; | ||
checkNode(namespaceExportDeclaration.name, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ImportEqualsDeclaration: | ||
const importEqualsDeclaration = node; | ||
checkNode(importEqualsDeclaration.name, context); | ||
checkNode(importEqualsDeclaration.moduleReference, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ImportDeclaration: | ||
const importDeclaration = node; | ||
checkNode(importDeclaration.importClause, context); | ||
checkNode(importDeclaration.moduleSpecifier, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ImportClause: | ||
const importClause = node; | ||
checkNode(importClause.name, context); | ||
checkNode(importClause.namedBindings, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.NamespaceImport: | ||
const namespaceImport = node; | ||
checkNode(namespaceImport.name, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.NamedImports: | ||
const namedImports = node; | ||
checkNodes(namedImports.elements, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ImportSpecifier: | ||
const importSpecifier = node; | ||
checkNode(importSpecifier.name, context); | ||
checkNode(importSpecifier.propertyName, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ExportAssignment: | ||
const exportAssignment = node; | ||
checkNode(exportAssignment.name, context); | ||
checkNode(exportAssignment.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ExportDeclaration: | ||
const exportDeclaration = node; | ||
checkNode(exportDeclaration.exportClause, context); | ||
checkNode(exportDeclaration.name, context); | ||
checkNode(exportDeclaration.moduleSpecifier, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.NamedExports: | ||
const namedExports = node; | ||
checkNodes(namedExports.elements, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ExportSpecifier: | ||
const exportSpecifier = node; | ||
checkNode(exportSpecifier.name, context); | ||
checkNode(exportSpecifier.propertyName, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.MissingDeclaration: | ||
const missingDeclaration = node; | ||
checkNode(missingDeclaration.name, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ExternalModuleReference: | ||
const externalModuleReference = node; | ||
checkNode(externalModuleReference.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxElement: | ||
const jsxElement = node; | ||
checkNode(jsxElement.openingElement, context); | ||
checkNode(jsxElement.closingElement, context); | ||
checkNodes(jsxElement.children, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxSelfClosingElement: | ||
const jsxSelfClosingElement = node; | ||
checkNode(jsxSelfClosingElement.attributes, context); | ||
checkNode(jsxSelfClosingElement.tagName, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxOpeningElement: | ||
const jsxOpeningElement = node; | ||
checkNode(jsxOpeningElement.attributes, context); | ||
checkNode(jsxOpeningElement.tagName, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxClosingElement: | ||
const jsxClosingElement = node; | ||
checkNode(jsxClosingElement.tagName, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxFragment: | ||
const jsxFragment = node; | ||
checkNode(jsxFragment.openingFragment, context); | ||
checkNode(jsxFragment.closingFragment, context); | ||
checkNodes(jsxFragment.children, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxOpeningFragment: | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxClosingFragment: | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxAttribute: | ||
const jsxAttribute = node; | ||
checkNode(jsxAttribute.name, context); | ||
checkNode(jsxAttribute.initializer, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxAttributes: | ||
const jsxAttributes = node; | ||
checkNodes(jsxAttributes.properties, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxSpreadAttribute: | ||
const jsxSpreadAttribute = node; | ||
checkNode(jsxSpreadAttribute.name, context); | ||
checkNode(jsxSpreadAttribute.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.JsxExpression: | ||
const jsxExpression = node; | ||
checkNode(jsxExpression.dotDotDotToken, context); | ||
checkNode(jsxExpression.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.CaseClause: | ||
const caseClause = node; | ||
checkNodes(caseClause.statements, context); | ||
checkNode(caseClause.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.DefaultClause: | ||
const defaultClause = node; | ||
checkNodes(defaultClause.statements, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.HeritageClause: | ||
const heritageClause = node; | ||
checkNodes(heritageClause.types, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.CatchClause: | ||
const catchClause = node; | ||
if (context.ignoreCatch) { | ||
const copyContext = Object.assign({}, context); | ||
copyContext.catchVariables = Object.assign({}, context.catchVariables); | ||
if (catchClause.variableDeclaration) { | ||
const decl = catchClause.variableDeclaration; | ||
if (decl.name.kind === typescript_1.default.SyntaxKind.Identifier) { | ||
copyContext.catchVariables[decl.name.escapedText] = true; | ||
} | ||
if (skippedNodeKinds.has(node.kind)) { | ||
return; | ||
} | ||
if (node.kind === typescript_1.default.SyntaxKind.ThisKeyword) { | ||
collectData(node, context); | ||
return; | ||
} | ||
if (typescript_1.default.isIdentifier(node)) { | ||
if (context.catchVariables[node.escapedText]) { | ||
return; | ||
} | ||
collectData(node, context); | ||
return; | ||
} | ||
if (typescript_1.default.isQualifiedName(node)) { | ||
checkNode(node.left, context); | ||
checkNode(node.right, context); | ||
return; | ||
} | ||
if (typescript_1.default.isComputedPropertyName(node)) { | ||
checkNode(node.expression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypeParameterDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.default, context); | ||
checkNode(node.expression, context); | ||
checkNode(node.constraint, context); | ||
return; | ||
} | ||
if (typescript_1.default.isParameter(node)) { | ||
checkNode(node.dotDotDotToken, context); | ||
checkNode(node.name, context); | ||
checkNode(node.initializer, context); | ||
checkNode(node.type, context); | ||
checkNode(node.questionToken, context); | ||
return; | ||
} | ||
if (typescript_1.default.isDecorator(node)) { | ||
checkNode(node.expression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isPropertySignature(node) | ||
|| typescript_1.default.isPropertyDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.questionToken, context); | ||
checkNode(node.type, context); | ||
checkNode(node.initializer, context); | ||
return; | ||
} | ||
if (typescript_1.default.isMethodSignature(node) | ||
|| typescript_1.default.isCallSignatureDeclaration(node) | ||
|| typescript_1.default.isConstructSignatureDeclaration(node) | ||
|| typescript_1.default.isIndexSignatureDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNodes(node.parameters, context); | ||
checkNode(node.questionToken, context); | ||
checkNode(node.type, context); | ||
checkNodes(node.typeParameters, context); | ||
return; | ||
} | ||
if (typescript_1.default.isFunctionTypeNode(node) | ||
|| typescript_1.default.isConstructorTypeNode(node)) { | ||
checkNode(node.name, context); | ||
checkNodes(node.parameters, context); | ||
checkNode(node.type, context); | ||
checkNodes(node.typeParameters, context); | ||
return; | ||
} | ||
if (typescript_1.default.isMethodDeclaration(node) | ||
|| typescript_1.default.isConstructorDeclaration(node) | ||
|| typescript_1.default.isGetAccessorDeclaration(node) | ||
|| typescript_1.default.isSetAccessorDeclaration(node) | ||
|| typescript_1.default.isFunctionExpression(node) | ||
|| typescript_1.default.isArrowFunction(node) | ||
|| typescript_1.default.isFunctionDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNodes(node.parameters, context); | ||
checkNode(node.body, context); | ||
checkNode(node.asteriskToken, context); | ||
checkNode(node.questionToken, context); | ||
checkNode(node.type, context); | ||
checkNodes(node.typeParameters, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypePredicateNode(node)) { | ||
checkNode(node.type, context); | ||
checkNode(node.parameterName, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypeReferenceNode(node)) { | ||
checkNode(node.typeName, context); | ||
checkNodes(node.typeArguments, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypeQueryNode(node)) { | ||
checkNode(node.exprName, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypeLiteralNode(node)) { | ||
checkNodes(node.members, context); | ||
return; | ||
} | ||
if (typescript_1.default.isArrayTypeNode(node)) { | ||
checkNode(node.elementType, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTupleTypeNode(node)) { | ||
checkNodes(node.elementTypes, context); | ||
return; | ||
} | ||
if (typescript_1.default.isUnionTypeNode(node) | ||
|| typescript_1.default.isIntersectionTypeNode(node) | ||
|| typescript_1.default.isHeritageClause(node)) { | ||
checkNodes(node.types, context); | ||
return; | ||
} | ||
if (typescript_1.default.isConditionalTypeNode(node)) { | ||
checkNode(node.checkType, context); | ||
checkNode(node.extendsType, context); | ||
checkNode(node.trueType, context); | ||
checkNode(node.falseType, context); | ||
return; | ||
} | ||
if (typescript_1.default.isInferTypeNode(node)) { | ||
checkNode(node.typeParameter, context); | ||
return; | ||
} | ||
if (typescript_1.default.isParenthesizedTypeNode(node) | ||
|| typescript_1.default.isTypeOperatorNode(node)) { | ||
checkNode(node.type, context); | ||
return; | ||
} | ||
if (typescript_1.default.isIndexedAccessTypeNode(node)) { | ||
checkNode(node.objectType, context); | ||
checkNode(node.indexType, context); | ||
return; | ||
} | ||
if (typescript_1.default.isMappedTypeNode(node)) { | ||
checkNode(node.questionToken, context); | ||
checkNode(node.readonlyToken, context); | ||
checkNode(node.type, context); | ||
checkNode(node.typeParameter, context); | ||
return; | ||
} | ||
if (typescript_1.default.isLiteralTypeNode(node)) { | ||
checkNode(node.literal, context); | ||
return; | ||
} | ||
if (typescript_1.default.isImportTypeNode(node)) { | ||
checkNode(node.qualifier, context); | ||
checkNode(node.argument, context); | ||
checkNodes(node.typeArguments, context); | ||
return; | ||
} | ||
if (typescript_1.default.isObjectBindingPattern(node) | ||
|| typescript_1.default.isArrayBindingPattern(node) | ||
|| typescript_1.default.isArrayLiteralExpression(node) | ||
|| typescript_1.default.isNamedImports(node) | ||
|| typescript_1.default.isNamedExports(node)) { | ||
checkNodes(node.elements, context); | ||
return; | ||
} | ||
if (typescript_1.default.isBindingElement(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.initializer, context); | ||
checkNode(node.dotDotDotToken, context); | ||
checkNode(node.propertyName, context); | ||
return; | ||
} | ||
if (typescript_1.default.isObjectLiteralExpression(node) | ||
|| typescript_1.default.isJsxAttributes(node)) { | ||
checkNodes(node.properties, context); | ||
return; | ||
} | ||
if (typescript_1.default.isPropertyAccessExpression(node) | ||
|| typescript_1.default.isExportAssignment(node) | ||
|| typescript_1.default.isJsxSpreadAttribute(node) | ||
|| typescript_1.default.isSpreadAssignment(node)) { | ||
checkNode(node.expression, context); | ||
checkNode(node.name, context); | ||
return; | ||
} | ||
if (typescript_1.default.isElementAccessExpression(node)) { | ||
checkNode(node.expression, context); | ||
checkNode(node.argumentExpression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isCallExpression(node) | ||
|| typescript_1.default.isNewExpression(node)) { | ||
checkNode(node.expression, context); | ||
checkNodes(node.arguments, context); | ||
checkNodes(node.typeArguments, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypeAssertion(node)) { | ||
checkTypeAssertion(node, context); | ||
checkNode(node.expression, context); | ||
checkNode(node.type, context); | ||
return; | ||
} | ||
if (typescript_1.default.isParenthesizedExpression(node) | ||
|| typescript_1.default.isDeleteExpression(node) | ||
|| typescript_1.default.isTypeOfExpression(node) | ||
|| typescript_1.default.isVoidExpression(node) | ||
|| typescript_1.default.isAwaitExpression(node) | ||
|| typescript_1.default.isYieldExpression(node) | ||
|| typescript_1.default.isSpreadElement(node) | ||
|| typescript_1.default.isExpressionStatement(node) | ||
|| typescript_1.default.isReturnStatement(node) | ||
|| typescript_1.default.isThrowStatement(node) | ||
|| typescript_1.default.isExternalModuleReference(node)) { | ||
checkNode(node.expression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTaggedTemplateExpression(node)) { | ||
checkNode(node.template, context); | ||
return; | ||
} | ||
if (typescript_1.default.isPrefixUnaryExpression(node) | ||
|| typescript_1.default.isPostfixUnaryExpression(node)) { | ||
checkNode(node.operand, context); | ||
return; | ||
} | ||
if (typescript_1.default.isBinaryExpression(node)) { | ||
checkNode(node.left, context); | ||
checkNode(node.right, context); | ||
checkNode(node.operatorToken, context); | ||
return; | ||
} | ||
if (typescript_1.default.isConditionalExpression(node)) { | ||
checkNode(node.condition, context); | ||
checkNode(node.colonToken, context); | ||
checkNode(node.questionToken, context); | ||
checkNode(node.whenTrue, context); | ||
checkNode(node.whenFalse, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTemplateExpression(node)) { | ||
checkNodes(node.templateSpans, context); | ||
return; | ||
} | ||
if (typescript_1.default.isClassExpression(node) | ||
|| typescript_1.default.isClassDeclaration(node) | ||
|| typescript_1.default.isInterfaceDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNodes(node.typeParameters, context); | ||
checkNodes(node.members, context); | ||
checkNodes(node.heritageClauses, context); | ||
return; | ||
} | ||
if (typescript_1.default.isExpressionWithTypeArguments(node)) { | ||
checkNode(node.expression, context); | ||
checkNodes(node.typeArguments, context); | ||
return; | ||
} | ||
if (typescript_1.default.isAsExpression(node)) { | ||
checkTypeAssertion(node, context); | ||
checkNode(node.expression, context); | ||
checkNode(node.type, context); | ||
return; | ||
} | ||
if (typescript_1.default.isNonNullExpression(node)) { | ||
checkTypeAssertion(node, context); | ||
checkNode(node.expression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isMetaProperty(node) | ||
|| typescript_1.default.isSemicolonClassElement(node) | ||
|| typescript_1.default.isNamespaceExportDeclaration(node) | ||
|| typescript_1.default.isNamespaceImport(node) | ||
|| typescript_1.default.isMissingDeclaration(node)) { | ||
checkNode(node.name, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTemplateSpan(node)) { | ||
checkNode(node.expression, context); | ||
checkNode(node.literal, context); | ||
return; | ||
} | ||
if (typescript_1.default.isBlock(node) | ||
|| typescript_1.default.isModuleBlock(node) | ||
|| typescript_1.default.isDefaultClause(node)) { | ||
checkNodes(node.statements, context); | ||
return; | ||
} | ||
if (typescript_1.default.isVariableStatement(node)) { | ||
checkNode(node.declarationList, context); | ||
return; | ||
} | ||
if (typescript_1.default.isIfStatement(node)) { | ||
checkNode(node.expression, context); | ||
checkNode(node.thenStatement, context); | ||
checkNode(node.elseStatement, context); | ||
return; | ||
} | ||
if (typescript_1.default.isDoStatement(node) | ||
|| typescript_1.default.isWhileStatement(node) | ||
|| typescript_1.default.isWithStatement(node)) { | ||
checkNode(node.expression, context); | ||
checkNode(node.statement, context); | ||
return; | ||
} | ||
if (typescript_1.default.isForStatement(node)) { | ||
checkNode(node.initializer, context); | ||
checkNode(node.condition, context); | ||
checkNode(node.incrementor, context); | ||
checkNode(node.statement, context); | ||
return; | ||
} | ||
if (typescript_1.default.isForInStatement(node)) { | ||
checkNode(node.initializer, context); | ||
checkNode(node.expression, context); | ||
checkNode(node.statement, context); | ||
return; | ||
} | ||
if (typescript_1.default.isForOfStatement(node)) { | ||
checkNode(node.initializer, context); | ||
checkNode(node.statement, context); | ||
checkNode(node.expression, context); | ||
checkNode(node.awaitModifier, context); | ||
return; | ||
} | ||
if (typescript_1.default.isSwitchStatement(node)) { | ||
checkNode(node.expression, context); | ||
checkNode(node.caseBlock, context); | ||
return; | ||
} | ||
if (typescript_1.default.isLabeledStatement(node)) { | ||
checkNode(node.label, context); | ||
checkNode(node.statement, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTryStatement(node)) { | ||
checkNode(node.tryBlock, context); | ||
checkNode(node.catchClause, context); | ||
checkNode(node.finallyBlock, context); | ||
return; | ||
} | ||
if (typescript_1.default.isVariableDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.type, context); | ||
checkNode(node.initializer, context); | ||
return; | ||
} | ||
if (typescript_1.default.isVariableDeclarationList(node)) { | ||
checkNodes(node.declarations, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypeAliasDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.type, context); | ||
checkNodes(node.typeParameters, context); | ||
return; | ||
} | ||
if (typescript_1.default.isEnumDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNodes(node.members, context); | ||
return; | ||
} | ||
if (typescript_1.default.isModuleDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.body, context); | ||
return; | ||
} | ||
if (typescript_1.default.isCaseBlock(node)) { | ||
checkNodes(node.clauses, context); | ||
return; | ||
} | ||
if (typescript_1.default.isImportEqualsDeclaration(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.moduleReference, context); | ||
return; | ||
} | ||
if (typescript_1.default.isImportDeclaration(node)) { | ||
checkNode(node.importClause, context); | ||
checkNode(node.moduleSpecifier, context); | ||
return; | ||
} | ||
if (typescript_1.default.isImportClause(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.namedBindings, context); | ||
return; | ||
} | ||
if (typescript_1.default.isImportSpecifier(node) | ||
|| typescript_1.default.isExportSpecifier(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.propertyName, context); | ||
return; | ||
} | ||
if (typescript_1.default.isExportDeclaration(node)) { | ||
checkNode(node.exportClause, context); | ||
checkNode(node.name, context); | ||
checkNode(node.moduleSpecifier, context); | ||
return; | ||
} | ||
if (typescript_1.default.isJsxElement(node)) { | ||
checkNode(node.openingElement, context); | ||
checkNode(node.closingElement, context); | ||
checkNodes(node.children, context); | ||
return; | ||
} | ||
if (typescript_1.default.isJsxSelfClosingElement(node) | ||
|| typescript_1.default.isJsxOpeningElement(node)) { | ||
checkNode(node.attributes, context); | ||
checkNode(node.tagName, context); | ||
return; | ||
} | ||
if (typescript_1.default.isJsxClosingElement(node)) { | ||
checkNode(node.tagName, context); | ||
return; | ||
} | ||
if (typescript_1.default.isJsxFragment(node)) { | ||
checkNode(node.openingFragment, context); | ||
checkNode(node.closingFragment, context); | ||
checkNodes(node.children, context); | ||
return; | ||
} | ||
if (typescript_1.default.isJsxAttribute(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.initializer, context); | ||
return; | ||
} | ||
if (typescript_1.default.isJsxExpression(node)) { | ||
checkNode(node.dotDotDotToken, context); | ||
checkNode(node.expression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isCaseClause(node)) { | ||
checkNodes(node.statements, context); | ||
checkNode(node.expression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isCatchClause(node)) { | ||
if (context.ignoreCatch) { | ||
const copyContext = Object.assign({}, context); | ||
copyContext.catchVariables = Object.assign({}, context.catchVariables); | ||
if (node.variableDeclaration) { | ||
const decl = node.variableDeclaration; | ||
if (decl.name.kind === typescript_1.default.SyntaxKind.Identifier) { | ||
copyContext.catchVariables[decl.name.escapedText] = true; | ||
} | ||
checkNode(catchClause.variableDeclaration, copyContext); | ||
} | ||
else { | ||
checkNode(catchClause.block, context); | ||
checkNode(catchClause.variableDeclaration, context); | ||
} | ||
break; | ||
case typescript_1.default.SyntaxKind.PropertyAssignment: | ||
const propertyAssignmentExpression = node; | ||
checkNode(propertyAssignmentExpression.name, context); | ||
checkNode(propertyAssignmentExpression.questionToken, context); | ||
checkNode(propertyAssignmentExpression.initializer, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.ShorthandPropertyAssignment: | ||
const shorthandPropertyAssignment = node; | ||
checkNode(shorthandPropertyAssignment.name, context); | ||
checkNode(shorthandPropertyAssignment.questionToken, context); | ||
checkNode(shorthandPropertyAssignment.equalsToken, context); | ||
checkNode(shorthandPropertyAssignment.objectAssignmentInitializer, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.SpreadAssignment: | ||
const spreadAssignment = node; | ||
checkNode(spreadAssignment.name, context); | ||
checkNode(spreadAssignment.expression, context); | ||
break; | ||
case typescript_1.default.SyntaxKind.EnumMember: | ||
case typescript_1.default.SyntaxKind.SourceFile: | ||
case typescript_1.default.SyntaxKind.Bundle: | ||
case typescript_1.default.SyntaxKind.JSDocTypeExpression: | ||
case typescript_1.default.SyntaxKind.JSDocAllType: | ||
case typescript_1.default.SyntaxKind.JSDocUnknownType: | ||
case typescript_1.default.SyntaxKind.JSDocNullableType: | ||
case typescript_1.default.SyntaxKind.JSDocNonNullableType: | ||
case typescript_1.default.SyntaxKind.JSDocOptionalType: | ||
case typescript_1.default.SyntaxKind.JSDocFunctionType: | ||
case typescript_1.default.SyntaxKind.JSDocVariadicType: | ||
case typescript_1.default.SyntaxKind.JSDocComment: | ||
case typescript_1.default.SyntaxKind.JSDocTag: | ||
case typescript_1.default.SyntaxKind.JSDocAugmentsTag: | ||
case typescript_1.default.SyntaxKind.JSDocClassTag: | ||
case typescript_1.default.SyntaxKind.JSDocParameterTag: | ||
case typescript_1.default.SyntaxKind.JSDocReturnTag: | ||
case typescript_1.default.SyntaxKind.JSDocTypeTag: | ||
case typescript_1.default.SyntaxKind.JSDocTemplateTag: | ||
case typescript_1.default.SyntaxKind.JSDocTypedefTag: | ||
case typescript_1.default.SyntaxKind.JSDocPropertyTag: | ||
case typescript_1.default.SyntaxKind.JSDocTypeLiteral: | ||
case typescript_1.default.SyntaxKind.SyntaxList: | ||
case typescript_1.default.SyntaxKind.NotEmittedStatement: | ||
case typescript_1.default.SyntaxKind.PartiallyEmittedExpression: | ||
case typescript_1.default.SyntaxKind.CommaListExpression: | ||
case typescript_1.default.SyntaxKind.MergeDeclarationMarker: | ||
case typescript_1.default.SyntaxKind.EndOfDeclarationMarker: | ||
case typescript_1.default.SyntaxKind.Count: | ||
break; | ||
default: | ||
console.log(`warning: unhandled node kind: ${node.kind}`); | ||
checkNode(node.variableDeclaration, copyContext); | ||
} | ||
else { | ||
checkNode(node.block, context); | ||
checkNode(node.variableDeclaration, context); | ||
} | ||
return; | ||
} | ||
if (typescript_1.default.isPropertyAssignment(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.questionToken, context); | ||
checkNode(node.initializer, context); | ||
return; | ||
} | ||
if (typescript_1.default.isShorthandPropertyAssignment(node)) { | ||
checkNode(node.name, context); | ||
checkNode(node.questionToken, context); | ||
checkNode(node.equalsToken, context); | ||
checkNode(node.objectAssignmentInitializer, context); | ||
return; | ||
} | ||
if (node.kind === typescript_1.default.SyntaxKind.RestType) { | ||
checkNode(node.type, context); | ||
return; | ||
} | ||
console.log(`warning: unhandled node kind: ${node.kind}`); | ||
} | ||
exports.checkNode = checkNode; | ||
const skippedNodeKinds = new Set([ | ||
typescript_1.default.SyntaxKind.Unknown, | ||
typescript_1.default.SyntaxKind.EndOfFileToken, | ||
typescript_1.default.SyntaxKind.SingleLineCommentTrivia, | ||
typescript_1.default.SyntaxKind.MultiLineCommentTrivia, | ||
typescript_1.default.SyntaxKind.NewLineTrivia, | ||
typescript_1.default.SyntaxKind.WhitespaceTrivia, | ||
typescript_1.default.SyntaxKind.ShebangTrivia, | ||
typescript_1.default.SyntaxKind.ConflictMarkerTrivia, | ||
typescript_1.default.SyntaxKind.NumericLiteral, | ||
typescript_1.default.SyntaxKind.StringLiteral, | ||
typescript_1.default.SyntaxKind.JsxText, | ||
typescript_1.default.SyntaxKind.JsxTextAllWhiteSpaces, | ||
typescript_1.default.SyntaxKind.RegularExpressionLiteral, | ||
typescript_1.default.SyntaxKind.NoSubstitutionTemplateLiteral, | ||
typescript_1.default.SyntaxKind.TemplateHead, | ||
typescript_1.default.SyntaxKind.TemplateMiddle, | ||
typescript_1.default.SyntaxKind.TemplateTail, | ||
typescript_1.default.SyntaxKind.OpenBraceToken, | ||
typescript_1.default.SyntaxKind.CloseBraceToken, | ||
typescript_1.default.SyntaxKind.OpenParenToken, | ||
typescript_1.default.SyntaxKind.CloseParenToken, | ||
typescript_1.default.SyntaxKind.OpenBracketToken, | ||
typescript_1.default.SyntaxKind.CloseBracketToken, | ||
typescript_1.default.SyntaxKind.DotToken, | ||
typescript_1.default.SyntaxKind.DotDotDotToken, | ||
typescript_1.default.SyntaxKind.SemicolonToken, | ||
typescript_1.default.SyntaxKind.CommaToken, | ||
typescript_1.default.SyntaxKind.LessThanToken, | ||
typescript_1.default.SyntaxKind.LessThanSlashToken, | ||
typescript_1.default.SyntaxKind.GreaterThanToken, | ||
typescript_1.default.SyntaxKind.LessThanEqualsToken, | ||
typescript_1.default.SyntaxKind.GreaterThanEqualsToken, | ||
typescript_1.default.SyntaxKind.EqualsEqualsToken, | ||
typescript_1.default.SyntaxKind.ExclamationEqualsToken, | ||
typescript_1.default.SyntaxKind.EqualsEqualsEqualsToken, | ||
typescript_1.default.SyntaxKind.ExclamationEqualsEqualsToken, | ||
typescript_1.default.SyntaxKind.EqualsGreaterThanToken, | ||
typescript_1.default.SyntaxKind.PlusToken, | ||
typescript_1.default.SyntaxKind.MinusToken, | ||
typescript_1.default.SyntaxKind.AsteriskToken, | ||
typescript_1.default.SyntaxKind.AsteriskAsteriskToken, | ||
typescript_1.default.SyntaxKind.SlashToken, | ||
typescript_1.default.SyntaxKind.PercentToken, | ||
typescript_1.default.SyntaxKind.PlusPlusToken, | ||
typescript_1.default.SyntaxKind.MinusMinusToken, | ||
typescript_1.default.SyntaxKind.LessThanLessThanToken, | ||
typescript_1.default.SyntaxKind.GreaterThanGreaterThanToken, | ||
typescript_1.default.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, | ||
typescript_1.default.SyntaxKind.AmpersandToken, | ||
typescript_1.default.SyntaxKind.BarToken, | ||
typescript_1.default.SyntaxKind.CaretToken, | ||
typescript_1.default.SyntaxKind.ExclamationToken, | ||
typescript_1.default.SyntaxKind.TildeToken, | ||
typescript_1.default.SyntaxKind.AmpersandAmpersandToken, | ||
typescript_1.default.SyntaxKind.BarBarToken, | ||
typescript_1.default.SyntaxKind.QuestionToken, | ||
typescript_1.default.SyntaxKind.ColonToken, | ||
typescript_1.default.SyntaxKind.AtToken, | ||
typescript_1.default.SyntaxKind.QuestionQuestionToken, | ||
typescript_1.default.SyntaxKind.EqualsToken, | ||
typescript_1.default.SyntaxKind.PlusEqualsToken, | ||
typescript_1.default.SyntaxKind.MinusEqualsToken, | ||
typescript_1.default.SyntaxKind.AsteriskEqualsToken, | ||
typescript_1.default.SyntaxKind.AsteriskAsteriskEqualsToken, | ||
typescript_1.default.SyntaxKind.SlashEqualsToken, | ||
typescript_1.default.SyntaxKind.PercentEqualsToken, | ||
typescript_1.default.SyntaxKind.LessThanLessThanEqualsToken, | ||
typescript_1.default.SyntaxKind.GreaterThanGreaterThanEqualsToken, | ||
typescript_1.default.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, | ||
typescript_1.default.SyntaxKind.AmpersandEqualsToken, | ||
typescript_1.default.SyntaxKind.BarEqualsToken, | ||
typescript_1.default.SyntaxKind.CaretEqualsToken, | ||
typescript_1.default.SyntaxKind.BreakKeyword, | ||
typescript_1.default.SyntaxKind.CaseKeyword, | ||
typescript_1.default.SyntaxKind.CatchKeyword, | ||
typescript_1.default.SyntaxKind.ClassKeyword, | ||
typescript_1.default.SyntaxKind.ConstKeyword, | ||
typescript_1.default.SyntaxKind.ContinueKeyword, | ||
typescript_1.default.SyntaxKind.DebuggerKeyword, | ||
typescript_1.default.SyntaxKind.DefaultKeyword, | ||
typescript_1.default.SyntaxKind.DeleteKeyword, | ||
typescript_1.default.SyntaxKind.DoKeyword, | ||
typescript_1.default.SyntaxKind.ElseKeyword, | ||
typescript_1.default.SyntaxKind.EnumKeyword, | ||
typescript_1.default.SyntaxKind.ExportKeyword, | ||
typescript_1.default.SyntaxKind.ExtendsKeyword, | ||
typescript_1.default.SyntaxKind.FalseKeyword, | ||
typescript_1.default.SyntaxKind.FinallyKeyword, | ||
typescript_1.default.SyntaxKind.ForKeyword, | ||
typescript_1.default.SyntaxKind.FunctionKeyword, | ||
typescript_1.default.SyntaxKind.IfKeyword, | ||
typescript_1.default.SyntaxKind.ImportKeyword, | ||
typescript_1.default.SyntaxKind.InKeyword, | ||
typescript_1.default.SyntaxKind.InstanceOfKeyword, | ||
typescript_1.default.SyntaxKind.NewKeyword, | ||
typescript_1.default.SyntaxKind.NullKeyword, | ||
typescript_1.default.SyntaxKind.ReturnKeyword, | ||
typescript_1.default.SyntaxKind.SuperKeyword, | ||
typescript_1.default.SyntaxKind.SwitchKeyword, | ||
typescript_1.default.SyntaxKind.ThrowKeyword, | ||
typescript_1.default.SyntaxKind.TrueKeyword, | ||
typescript_1.default.SyntaxKind.TryKeyword, | ||
typescript_1.default.SyntaxKind.TypeOfKeyword, | ||
typescript_1.default.SyntaxKind.VarKeyword, | ||
typescript_1.default.SyntaxKind.VoidKeyword, | ||
typescript_1.default.SyntaxKind.WhileKeyword, | ||
typescript_1.default.SyntaxKind.WithKeyword, | ||
typescript_1.default.SyntaxKind.ImplementsKeyword, | ||
typescript_1.default.SyntaxKind.InterfaceKeyword, | ||
typescript_1.default.SyntaxKind.LetKeyword, | ||
typescript_1.default.SyntaxKind.PackageKeyword, | ||
typescript_1.default.SyntaxKind.PrivateKeyword, | ||
typescript_1.default.SyntaxKind.ProtectedKeyword, | ||
typescript_1.default.SyntaxKind.PublicKeyword, | ||
typescript_1.default.SyntaxKind.StaticKeyword, | ||
typescript_1.default.SyntaxKind.YieldKeyword, | ||
typescript_1.default.SyntaxKind.AbstractKeyword, | ||
typescript_1.default.SyntaxKind.AsKeyword, | ||
typescript_1.default.SyntaxKind.AnyKeyword, | ||
typescript_1.default.SyntaxKind.AsyncKeyword, | ||
typescript_1.default.SyntaxKind.AwaitKeyword, | ||
typescript_1.default.SyntaxKind.BooleanKeyword, | ||
typescript_1.default.SyntaxKind.ConstructorKeyword, | ||
typescript_1.default.SyntaxKind.DeclareKeyword, | ||
typescript_1.default.SyntaxKind.GetKeyword, | ||
typescript_1.default.SyntaxKind.IsKeyword, | ||
typescript_1.default.SyntaxKind.KeyOfKeyword, | ||
typescript_1.default.SyntaxKind.ModuleKeyword, | ||
typescript_1.default.SyntaxKind.NamespaceKeyword, | ||
typescript_1.default.SyntaxKind.NeverKeyword, | ||
typescript_1.default.SyntaxKind.ReadonlyKeyword, | ||
typescript_1.default.SyntaxKind.RequireKeyword, | ||
typescript_1.default.SyntaxKind.NumberKeyword, | ||
typescript_1.default.SyntaxKind.ObjectKeyword, | ||
typescript_1.default.SyntaxKind.SetKeyword, | ||
typescript_1.default.SyntaxKind.StringKeyword, | ||
typescript_1.default.SyntaxKind.SymbolKeyword, | ||
typescript_1.default.SyntaxKind.TypeKeyword, | ||
typescript_1.default.SyntaxKind.UndefinedKeyword, | ||
typescript_1.default.SyntaxKind.UniqueKeyword, | ||
typescript_1.default.SyntaxKind.UnknownKeyword, | ||
typescript_1.default.SyntaxKind.FromKeyword, | ||
typescript_1.default.SyntaxKind.GlobalKeyword, | ||
typescript_1.default.SyntaxKind.BigIntKeyword, | ||
typescript_1.default.SyntaxKind.OfKeyword, | ||
typescript_1.default.SyntaxKind.OptionalType, | ||
typescript_1.default.SyntaxKind.ThisType, | ||
typescript_1.default.SyntaxKind.OmittedExpression, | ||
typescript_1.default.SyntaxKind.EmptyStatement, | ||
typescript_1.default.SyntaxKind.ContinueStatement, | ||
typescript_1.default.SyntaxKind.BreakStatement, | ||
typescript_1.default.SyntaxKind.DebuggerStatement, | ||
typescript_1.default.SyntaxKind.JsxOpeningFragment, | ||
typescript_1.default.SyntaxKind.JsxClosingFragment, | ||
typescript_1.default.SyntaxKind.EnumMember, | ||
typescript_1.default.SyntaxKind.SourceFile, | ||
typescript_1.default.SyntaxKind.Bundle, | ||
typescript_1.default.SyntaxKind.JSDocTypeExpression, | ||
typescript_1.default.SyntaxKind.JSDocAllType, | ||
typescript_1.default.SyntaxKind.JSDocUnknownType, | ||
typescript_1.default.SyntaxKind.JSDocNullableType, | ||
typescript_1.default.SyntaxKind.JSDocNonNullableType, | ||
typescript_1.default.SyntaxKind.JSDocOptionalType, | ||
typescript_1.default.SyntaxKind.JSDocFunctionType, | ||
typescript_1.default.SyntaxKind.JSDocVariadicType, | ||
typescript_1.default.SyntaxKind.JSDocComment, | ||
typescript_1.default.SyntaxKind.JSDocTag, | ||
typescript_1.default.SyntaxKind.JSDocAugmentsTag, | ||
typescript_1.default.SyntaxKind.JSDocClassTag, | ||
typescript_1.default.SyntaxKind.JSDocParameterTag, | ||
typescript_1.default.SyntaxKind.JSDocReturnTag, | ||
typescript_1.default.SyntaxKind.JSDocTypeTag, | ||
typescript_1.default.SyntaxKind.JSDocTemplateTag, | ||
typescript_1.default.SyntaxKind.JSDocTypedefTag, | ||
typescript_1.default.SyntaxKind.JSDocPropertyTag, | ||
typescript_1.default.SyntaxKind.JSDocTypeLiteral, | ||
typescript_1.default.SyntaxKind.SyntaxList, | ||
typescript_1.default.SyntaxKind.NotEmittedStatement, | ||
typescript_1.default.SyntaxKind.PartiallyEmittedExpression, | ||
typescript_1.default.SyntaxKind.CommaListExpression, | ||
typescript_1.default.SyntaxKind.MergeDeclarationMarker, | ||
typescript_1.default.SyntaxKind.EndOfDeclarationMarker, | ||
typescript_1.default.SyntaxKind.Count, | ||
]); |
@@ -12,6 +12,6 @@ "use strict"; | ||
let source; | ||
if (node.kind === typescript_1.default.SyntaxKind.ImportEqualsDeclaration) { | ||
if (typescript_1.default.isImportEqualsDeclaration(node)) { | ||
source = node.name.text; | ||
} | ||
else if (node.kind === typescript_1.default.SyntaxKind.ImportDeclaration) { | ||
else if (typescript_1.default.isImportDeclaration(node) && typescript_1.default.isIdentifier(node.moduleSpecifier)) { | ||
source = node.moduleSpecifier.text; | ||
@@ -18,0 +18,0 @@ } |
{ | ||
"name": "type-coverage-core", | ||
"version": "2.8.2", | ||
"version": "2.8.3", | ||
"description": "A library to check type coverage for typescript code", | ||
@@ -22,3 +22,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "b18eae530375734b542ee5b2c0d49d244c8a6720" | ||
"gitHead": "20bb0bcf1c57cca6931288e0990ad059b396b856" | ||
} |
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
47030
1153
1