ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
83 lines (82 loc) • 2.83 kB
TypeScript
import * as ts from "typescript";
import { EnumMember } from "./../enum";
import { Node, Symbol, Signature, Expression } from "./../common";
import { Type } from "./../type";
/**
* Wrapper around the TypeChecker.
*/
export declare class TypeChecker {
/**
* Gets the compiler's TypeChecker.
*/
readonly compilerObject: ts.TypeChecker;
/**
* Gets the apparent type of a type.
* @param type - Type to get the apparent type of.
*/
getApparentType(type: Type): Type<ts.Type>;
/**
* Gets the constant value of a declaration.
* @param node - Node to get the constant value from.
*/
getConstantValue(node: EnumMember): string | number | undefined;
/**
* Gets the fully qualified name of a symbol.
* @param symbol - Symbol to get the fully qualified name of.
*/
getFullyQualifiedName(symbol: Symbol): string;
/**
* Gets the type at the specified location.
* @param node - Node to get the type for.
*/
getTypeAtLocation(node: Node): Type;
/**
* Gets the contextual type of an expression.
* @param expression - Expression.
*/
getContextualType(expression: Expression): Type | undefined;
/**
* Gets the type of a symbol at the specified location.
* @param symbol - Symbol to get the type for.
* @param node - Location to get the type for.
*/
getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
/**
* Gets the declared type of a symbol.
* @param symbol - Symbol to get the type for.
*/
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
/**
* Gets the symbol at the specified location or undefined if none exists.
* @param node - Node to get the symbol for.
*/
getSymbolAtLocation(node: Node): Symbol | undefined;
/**
* Gets the aliased symbol of a symbol.
* @param symbol - Symbol to get the alias symbol of.
*/
getAliasedSymbol(symbol: Symbol): Symbol | undefined;
/**
* Gets the properties of a type.
* @param type - Type.
*/
getPropertiesOfType(type: Type): Symbol[];
/**
* Gets the type text
* @param type - Type to get the text of.
* @param enclosingNode - Enclosing node.
* @param typeFormatFlags - Type format flags.
*/
getTypeText(type: Type, enclosingNode?: Node, typeFormatFlags?: ts.TypeFormatFlags): string;
/**
* Gets the return type of a signature.
* @param signature - Signature to get the return type of.
*/
getReturnTypeOfSignature(signature: Signature): Type;
/**
* Gets a signature from a node.
* @param node - Node to get the signature from.
*/
getSignatureFromNode(node: Node<ts.SignatureDeclaration>): Signature | undefined;
private getDefaultTypeFormatFlags(enclosingNode?);
}