TypeChecker

external interface TypeChecker(source)

Properties

Link copied to clipboard
abstract external var getIndexInfosOfIndexSymbol: (indexSymbol: Symbol, ReadonlyArray<Symbol>?) -> ReadonlyArray<IndexInfo>

Functions

Link copied to clipboard
abstract external fun getAliasedSymbol(symbol: Symbol): Symbol

Follow all aliases to get the original symbol.

Link copied to clipboard
abstract external fun getAmbientModules(): ReadonlyArray<Symbol>
Link copied to clipboard
abstract external fun getAnyType(): Type

Gets the intrinsic any type. There are multiple types that act as any used internally in the compiler, so the type returned by this function should not be used in equality checks to determine if another type is any. Instead, use type.flags & TypeFlags.Any.

Link copied to clipboard
abstract external fun getApparentType(type: Type): Type
Link copied to clipboard
abstract external fun getAugmentedPropertiesOfType(type: Type): ReadonlyArray<Symbol>
Link copied to clipboard
abstract external fun getAwaitedType(type: Type): Type?

Gets the "awaited type" of a type.

Link copied to clipboard
abstract external fun getBaseConstraintOfType(type: Type): Type?
Link copied to clipboard
abstract external fun getBaseTypeOfLiteralType(type: Type): Type
Link copied to clipboard
abstract external fun getBaseTypes(type: InterfaceType): ReadonlyArray<BaseType>
Link copied to clipboard
abstract external fun getBigIntLiteralType(value: PseudoBigInt): BigIntLiteralType
Link copied to clipboard
abstract external fun getBigIntType(): Type
Link copied to clipboard
abstract external fun getBooleanType(): Type
Link copied to clipboard
abstract external fun getConstantValue(node: ElementAccessExpression): Any?
abstract external fun getConstantValue(node: EnumMember): Any?
abstract external fun getConstantValue(node: PropertyAccessExpression): Any?
Link copied to clipboard
abstract external fun getContextualType(node: Expression): Type?
Link copied to clipboard
abstract external fun getDeclaredTypeOfSymbol(symbol: Symbol): Type
Link copied to clipboard
abstract external fun getDefaultFromTypeParameter(type: Type): Type?
Link copied to clipboard
abstract external fun getESSymbolType(): Type
Link copied to clipboard
abstract external fun getExportsOfModule(moduleSymbol: Symbol): ReadonlyArray<Symbol>
Link copied to clipboard
abstract external fun getExportSpecifierLocalTargetSymbol(location: Identifier): Symbol?
Link copied to clipboard
abstract external fun getExportSymbolOfSymbol(symbol: Symbol): Symbol

If a symbol is a local symbol with an associated exported symbol, returns the exported symbol. Otherwise returns its input. For example, at export type T = number;: - getSymbolAtLocation at the location T will return the exported symbol for T. - But the result of getSymbolsInScope will contain the local symbol for T, not the exported symbol. - Calling getExportSymbolOfSymbol on that local symbol will return the exported symbol.

Link copied to clipboard
abstract external fun getFalseType(): Type
Link copied to clipboard
abstract external fun getFullyQualifiedName(symbol: Symbol): String
Link copied to clipboard
abstract external fun getImmediateAliasedSymbol(symbol: Symbol): Symbol?

Follow a single alias to get the immediately aliased symbol.

Link copied to clipboard
abstract external fun getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo?
Link copied to clipboard
abstract external fun getIndexInfosOfType(type: Type): ReadonlyArray<IndexInfo>
Link copied to clipboard
abstract external fun getIndexTypeOfType(type: Type, kind: IndexKind): Type?
Link copied to clipboard
abstract external fun getJsxIntrinsicTagNamesAt(location: Node): ReadonlyArray<Symbol>
Link copied to clipboard
abstract external fun getMergedSymbol(symbol: Symbol): Symbol
Link copied to clipboard
abstract external fun getNeverType(): Type

Gets the intrinsic never type. There are multiple types that act as never used internally in the compiler, so the type returned by this function should not be used in equality checks to determine if another type is never. Instead, use type.flags & TypeFlags.Never.

Link copied to clipboard
abstract external fun getNonNullableType(type: Type): Type
Link copied to clipboard
abstract external fun getNonPrimitiveType(): Type

Gets the intrinsic object type.

Link copied to clipboard
abstract external fun getNullableType(type: Type, flags: TypeFlags): Type
Link copied to clipboard
abstract external fun getNullType(): Type

Gets the intrinsic null type. There are multiple types that act as null used internally in the compiler, so the type returned by this function should not be used in equality checks to determine if another type is null. Instead, use type.flags & TypeFlags.Null.

Link copied to clipboard
abstract external fun getNumberLiteralType(value: Double): NumberLiteralType
Link copied to clipboard
abstract external fun getNumberType(): Type
Link copied to clipboard
abstract external fun getPrivateIdentifierPropertyOfType(leftType: Type, name: String, location: Node): Symbol?
Link copied to clipboard
abstract external fun getPropertiesOfType(type: Type): ReadonlyArray<Symbol>
Link copied to clipboard
abstract external fun getPropertyOfType(type: Type, propertyName: String): Symbol?
Link copied to clipboard
abstract external fun getResolvedSignature(node: CallLikeExpression, candidatesOutArray: ReadonlyArray<Signature> = definedExternally, argumentCount: Double = definedExternally): Signature?

returns unknownSignature in the case of an error. returns undefined if the node is not valid.

Link copied to clipboard
abstract external fun getReturnTypeOfSignature(signature: Signature): Type
Link copied to clipboard
abstract external fun getRootSymbols(symbol: Symbol): ReadonlyArray<Symbol>
Link copied to clipboard
abstract external fun getShorthandAssignmentValueSymbol(location: Node?): Symbol?

The function returns the value (local variable) symbol of an identifier in the short-hand property assignment. This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value.

Link copied to clipboard
abstract external fun getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature?
Link copied to clipboard
abstract external fun getSignaturesOfType(type: Type, kind: SignatureKind): ReadonlyArray<Signature>
Link copied to clipboard
abstract external fun getStringLiteralType(value: String): StringLiteralType
Link copied to clipboard
abstract external fun getStringType(): Type
Link copied to clipboard
abstract external fun getSymbolAtLocation(node: Node): Symbol?
Link copied to clipboard
abstract external fun getSymbolOfExpando(node: Node, allowDeclaration: Boolean): Symbol?
Link copied to clipboard
abstract external fun getSymbolsInScope(location: Node, meaning: SymbolFlags): ReadonlyArray<Symbol>
Link copied to clipboard
Link copied to clipboard
abstract external fun getTrueType(): Type
Link copied to clipboard
abstract external fun getTypeArguments(type: TypeReference): ReadonlyArray<Type>
Link copied to clipboard
Link copied to clipboard
abstract external fun getTypeAtLocation(node: Node): Type
Link copied to clipboard
abstract external fun getTypeFromTypeNode(node: TypeNode): Type
Link copied to clipboard
abstract external fun getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type
Link copied to clipboard
abstract external fun getTypeOfSymbol(symbol: Symbol): Type
Link copied to clipboard
abstract external fun getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type
Link copied to clipboard
abstract external fun getTypePredicateOfSignature(signature: Signature): TypePredicate?
Link copied to clipboard
abstract external fun getUndefinedType(): Type

Gets the intrinsic undefined type. There are multiple types that act as undefined used internally in the compiler depending on compiler options, so the type returned by this function should not be used in equality checks to determine if another type is undefined. Instead, use type.flags & TypeFlags.Undefined.

Link copied to clipboard
abstract external fun getUnknownType(): Type
Link copied to clipboard
abstract external fun getVoidType(): Type
Link copied to clipboard
abstract external fun getWidenedType(type: Type): Type
Link copied to clipboard
abstract external fun indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, enclosingDeclaration: Node?, flags: NodeBuilderFlags?): IndexSignatureDeclaration?

Note that the resulting nodes cannot be checked.

Link copied to clipboard
abstract external fun isArgumentsSymbol(symbol: Symbol): Boolean
Link copied to clipboard
abstract external fun isArrayLikeType(type: Type): Boolean

True if this type is assignable to ReadonlyArray<any>.

Link copied to clipboard
abstract external fun isArrayType(type: Type): Boolean

True if this type is the Array or ReadonlyArray type from lib.d.ts. This function will not return true if passed a type which extends Array (for example, the TypeScript AST's NodeArray type).

Link copied to clipboard
Link copied to clipboard
abstract external fun isOptionalParameter(node: ParameterDeclaration): Boolean
Link copied to clipboard
abstract external fun isTupleType(type: Type): Boolean

True if this type is a tuple type. This function will not return true if passed a type which extends from a tuple.

Link copied to clipboard
abstract external fun isTypeAssignableTo(source: Type, target: Type): Boolean

Returns true if the "source" type is assignable to the "target" type.

Link copied to clipboard
abstract external fun isUndefinedSymbol(symbol: Symbol): Boolean
Link copied to clipboard
abstract external fun isUnknownSymbol(symbol: Symbol): Boolean
Link copied to clipboard
abstract external fun isValidPropertyAccess(node: ImportTypeNode, propertyName: String): Boolean
abstract external fun isValidPropertyAccess(node: PropertyAccessExpression, propertyName: String): Boolean
abstract external fun isValidPropertyAccess(node: QualifiedName, propertyName: String): Boolean
Link copied to clipboard
abstract external fun resolveName(name: String, location: Node?, meaning: SymbolFlags, excludeGlobals: Boolean): Symbol?
Link copied to clipboard
abstract external fun <T> runWithCancellationToken(token: CancellationToken, cb: (checker: TypeChecker) -> T): T

Depending on the operation performed, it may be appropriate to throw away the checker if the cancellation token is triggered. Typically, if it is used for error checking and the operation is cancelled, then it should be discarded, otherwise it is safe to keep.

Link copied to clipboard
abstract external fun signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration: Node?, flags: NodeBuilderFlags?): TypeCheckerSignatureToSignatureDeclarationResult?

Note that the resulting nodes cannot be checked.

Link copied to clipboard
abstract external fun signatureToString(signature: Signature, enclosingDeclaration: Node = definedExternally, flags: TypeFormatFlags = definedExternally, kind: SignatureKind = definedExternally): String
Link copied to clipboard
abstract external fun symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node?, flags: NodeBuilderFlags?): EntityName?

Note that the resulting nodes cannot be checked.

Link copied to clipboard
abstract external fun symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node?, flags: NodeBuilderFlags?): Expression?

Note that the resulting nodes cannot be checked.

Link copied to clipboard
abstract external fun symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration: Node?, flags: NodeBuilderFlags?): ParameterDeclaration?

Note that the resulting nodes cannot be checked.

Link copied to clipboard
abstract external fun symbolToString(symbol: Symbol, enclosingDeclaration: Node = definedExternally, meaning: SymbolFlags = definedExternally, flags: SymbolFormatFlags = definedExternally): String
Link copied to clipboard
abstract external fun symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration: Node?, flags: NodeBuilderFlags?): NodeArray<TypeParameterDeclaration>?

Note that the resulting nodes cannot be checked.

Link copied to clipboard
abstract external fun tryGetMemberInModuleExports(memberName: String, moduleSymbol: Symbol): Symbol?
Link copied to clipboard
abstract external fun typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration: Node?, flags: NodeBuilderFlags?): TypeParameterDeclaration?

Note that the resulting nodes cannot be checked.

Link copied to clipboard
abstract external fun typePredicateToString(predicate: TypePredicate, enclosingDeclaration: Node = definedExternally, flags: TypeFormatFlags = definedExternally): String
Link copied to clipboard
abstract external fun typeToString(type: Type, enclosingDeclaration: Node = definedExternally, flags: TypeFormatFlags = definedExternally): String
Link copied to clipboard
abstract external fun typeToTypeNode(type: Type, enclosingDeclaration: Node?, flags: NodeBuilderFlags?): TypeNode?

Note that the resulting nodes cannot be checked.