CodeQL library for JavaScript
Search

Module TypeScript

Import path

import semmle.javascript.TypeScript

Imports

javascript

Provides classes for working with JavaScript programs, as well as JSON, YAML and HTML.

Classes

AnonymousInterfaceType

An anonymous interface type, such as { x: number }.

AnyType

The predefined any type.

ArrayType

A type that describes a JavaScript Array object.

ArrayTypeExpr

An array type, such as number[], or in general T[] where T is a type.

AsTypeAssertion

A type assertion specifically of the form E as T (as opposed to the <T> E syntax).

BigIntLiteralType

A bigint literal as a static type.

BigIntLiteralTypeExpr

A bigint literal used as a TypeScript type annotation.

BigIntType

The predefined bigint type.

BooleanLikeType

The boolean, true, or false type.

BooleanLiteralType

The boolean literal type true or false.

BooleanLiteralTypeExpr

A boolean literal used as a type.

BooleanType

The boolean type, internally represented as the union type true | false.

CallSignatureType

A function or constructor signature in a TypeScript type.

CanonicalTypeVariableType

A type that refers to a type variable declared on a class, interface or function.

ClassType

A type that refers to a class, possibly with type arguments.

ConditionalTypeExpr

A conditional type annotation, such as T extends any[] ? A : B.

ConditionalTypeScope

A scope induced by a conditional type expression whose extends type contains infer types.

ConstructorCallSignatureType

A constructor call signature in a type, that is, a signature with the new keyword.

ConstructorTypeExpr

A constructor type, such as new (x: string) => Object.

EnumDeclaration

A TypeScript enum declaration, such as the following declaration: enum Color { red = 1, green, blue }

EnumLiteralType

A type that refers to the value of an enum member.

EnumMember

A member of a TypeScript enum declaration, such as red in the following declaration: enum Color { red = 1, green, blue }

EnumScope

Scope induced by an enum declaration, containing the names of its enum members.

EnumType

A type that refers to an enum.

ExportAsNamespaceDeclaration

A TypeScript export of form export as namespace X where X is an identifier.

ExportAssignDeclaration

A TypeScript “export-assign” declaration.

ExpressionWithTypeArguments

An expression with type arguments, occurring as the super-class expression of a class, for example: class StringList extends List<string> In the above example, List is a concrete expression, string is a type annotation, and List<string> is thus an expression with type arguments.

ExternalModuleDeclaration

A TypeScript declaration of form declare module "X" {...} where X is the name of an external module.

ExternalModuleReference

A require() call in a TypeScript import-equals declaration, such as require("foo") in: import foo = require("foo");

ExternalModuleScope

Scope induced by a declaration of form declare module "X" {...}.

FunctionCallSignatureType

A function call signature in a type, that is, a signature without the new keyword.

FunctionTypeExpr

A TypeScript function type, such as (x: string) => number or a constructor type such as new (x: string) => Object.

GenericTypeExpr

A type consisting of a name and at least one type argument, such as Array<number>.

GlobalAugmentationDeclaration

A TypeScript declaration of form declare global {...}.

ImportEqualsDeclaration

A TypeScript “import-equals” declaration.

ImportNamespaceAccess

An import used in the context of a namespace inside a type annotation, such as in let x: import("http").ServerRequest.

ImportTypeAccess

An import used in the context of a type, such as in let x: import("foo").

ImportTypeExpr

An import inside a type annotation, such as in import("http").ServerRequest.

ImportVarTypeAccess

An import used in the context of a variable type, such as in let x: typeof import("fs").

IndexedAccessTypeExpr

A type of form T[K] where T and K are types.

InferTypeExpr

A type annotation of form infer R.

InterfaceDeclaration

A TypeScript interface declaration.

InterfaceDefinition

A TypeScript interface declaration, inline interface type, or function type.

InterfaceScope

Scope induced by an interface declaration, containing the type parameters declared on the interface.

InterfaceType

A type that refers to an interface, possibly with type arguents.

InterfaceTypeExpr

An inline TypeScript interface type, such as {x: number; y: number}.

IntersectionType

An intersection type, such as T & {x: number}.

IntersectionTypeExpr

A type of form S&T, denoting the intersection of type S and type T.

IsTypeExpr

A function return type of form x is T or asserts x is T.

KeyofTypeExpr

A type of form keyof T where T is a type.

LexicalTypeVariableType

A type that refers to a type variable without a canonical name.

LiteralType

A boolean, number, or string literal type.

LiteralTypeExpr

A string, number, or boolean literal used as a type.

LocalNamespaceAccess

An identifier that refers to a namespace from inside a type annotation.

LocalNamespaceDecl

An identifier that declares a local name for a namespace, that is, the name of an actual namespace declaration or the local name of an import.

LocalNamespaceName

The local name for a namespace in a particular scope.

LocalTypeAccess

An identifier that is used as part of a type, such as Date.

LocalTypeName

The local name for a type in a particular scope.

LocalVarTypeAccess

An identifier that refers to a variable from inside a type.

MappedTypeExpr

A type of form { [K in C]: T } where K in C declares a type parameter with C as the bound, and T is a type that may refer to K.

MappedTypeScope

Scope induced by a mapped type expression, containing the type parameter declared as part of the type.

NamespaceAccess

A possibly qualified name that refers to a namespace from inside a type annotation.

NamespaceDeclaration

A TypeScript namespace declaration.

NamespaceDefinition

A statement that defines a namespace, that is, a namespace declaration or enum declaration.

NamespaceRef

A possibly qualified identifier that refers to or declares a local name for a namespace.

NeverType

The never type.

NonNullAssertion

A TypeScript expression of form E!, asserting that E is not null.

NullType

The null type.

NumberLikeType

The number type or a number literal type.

NumberLiteralType

A number literal as a static type.

NumberLiteralTypeExpr

A number literal used as a type.

NumberType

The predefined number type.

ObjectKeywordType

The object type.

OptionalTypeExpr

An optional type element in a tuple type, such as number? in [string, number?].

ParenthesizedTypeExpr

A type expression enclosed in parentheses.

PlainArrayType

An array type such as Array<string>, or equivalently, string[].

PlainFunctionTypeExpr

A function type that is not a constructor type, such as (x: string) => number.

PlainSymbolType

The symbol type.

PredefinedTypeExpr

A use of the predefined type any, string, number, boolean, null, undefined, void, never, symbol, or object.

PredicateTypeExpr

A function return type that refines the type of one of its parameters or this.

PrefixTypeAssertion

A type assertion specifically of the form <T> E (as opposed to the E as T syntax).

PromiseType

A type such as Promise<T>, describing a promise or promise-like object.

QualifiedNamespaceAccess

A qualified name that refers to a namespace from inside a type annotation.

QualifiedTypeAccess

A qualified name that is used as part of a type, such as http.ServerRequest.

QualifiedVarTypeAccess

A qualified name that refers to a variable from inside a type.

ReadonlyArrayType

A read-only array type such as ReadonlyArray<string>.

ReadonlyTypeExpr

A type of form readonly T, such as readonly number[].

ReferenceImport

A TypeScript comment of one of the two forms: /// <reference path="FILE.d.ts"/> /// <reference types="NAME"/>

ReferencePathImport

A TypeScript comment of the form: /// <reference path="FILE.d.ts"/>

ReferenceTypesImport

A TypeScript comment of the form: /// <reference types="NAME" />

RestTypeExpr

A rest element in a tuple type, such as ...string[] in [number, ...string[]].

SignatureKind

One of two values indicating if a signature is a function or constructor signature.

StringLikeType

The string type or a string literal type.

StringLiteralType

A string literal as a static type.

StringLiteralTypeExpr

A string literal used as a type.

StringType

The predefined string type.

SymbolType

The symbol type or a specific unique symbol type.

TSGlobalDeclImport

A reference to a global variable for which there is a TypeScript type annotation suggesting that it contains the namespace object of a module.

TemplateLiteralTypeExpr

A template literal used as a type.

ThisType

A this type in a specific class or interface.

ThisTypeExpr

A use of the this type.

ThisVarTypeAccess

A this keyword used as the first operand to an is type.

TupleType

A tuple type, such as [number, string].

TupleTypeExpr

A tuple type such as [number, string].

Type

A static type in the TypeScript type system.

TypeAccess

A possibly qualified name that is used as part of a type, such as Date or http.ServerRequest.

TypeAliasDeclaration

A type alias declaration, that is, a statement of form type A = T.

TypeAliasReference

A type that refers to a type alias.

TypeAliasScope

Scope induced by a type alias declaration, containing the type parameters declared the the alias.

TypeAssertion

A type assertion, also known as an unchecked type cast, is a TypeScript expression of form E as T or <T> E where E is an expression and T is a type.

TypeDecl

An identifier declaring a type name, that is, the name of a class, interface, type parameter, or import.

TypeDefinition

A statement that defines a named type, that is, a class, interface, type alias, or enum declaration.

TypeExpr

A type expression, that is, an AST node that is part of a TypeScript type annotation.

TypeParameter

A type parameter declared on a class, interface, function, or type alias.

TypeParameterized

A program element that supports type parameters, that is, a function, class, interface, type alias, mapped type, or infer type.

TypeRef

A possibly qualified identifier that declares or refers to a type.

TypeReference

A type that refers to a class, interface, enum, or enum member.

TypeRootFolder

A folder where TypeScript finds declaration files for imported modules.

TypeVariableType

A type that refers to a type variable.

TypeofType

The type of a named value, typeof X, typically denoting the type of a class constructor, namespace object, enum object, or module object.

TypeofTypeExpr

A type of form typeof E where E is a possibly qualified name referring to a variable, function, class, or namespace.

UndefinedType

The undefined type.

UnionOrIntersectionType

A union type or intersection type, such as string | number or T & U.

UnionType

A union type, such as string | number.

UnionTypeExpr

A union type, such as string|number|boolean.

UniqueSymbolType

A unique symbol type.

UnknownType

The predefined unknown type.

VarTypeAccess

A possibly qualified name that refers to a variable from inside a type.

VoidType

The void type.

Modules