ts-simple-ast
Version:
TypeScript compiler wrapper for static analysis and code manipulation.
1,290 lines (1,271 loc) • 388 kB
TypeScript
import * as ts from "typescript";
import { SyntaxKind, CompilerOptions, EmitHint, ScriptKind, NewLineKind, LanguageVariant, ScriptTarget, TypeFlags, ObjectFlags, SymbolFlags, TypeFormatFlags, DiagnosticCategory, EditorSettings, ModuleResolutionKind } from "typescript";
import { CodeBlockWriter } from "./code-block-writer";
export declare class Directory {
private __context;
private _path;
private _pathParts;
private constructor();
/**
* Checks if this directory is an ancestor of the provided directory.
* @param possibleDescendant - Directory or source file that's a possible descendant.
*/
isAncestorOf(possibleDescendant: Directory | SourceFile): boolean;
/**
* Checks if this directory is a descendant of the provided directory.
* @param possibleAncestor - Directory or source file that's a possible ancestor.
*/
isDescendantOf(possibleAncestor: Directory): boolean;
/**
* Gets the path to the directory.
*/
getPath(): string;
/**
* Gets the directory path's base name.
*/
getBaseName(): string;
/**
* Gets the parent directory or throws if it doesn't exist or was never added to the project.
*/
getParentOrThrow(): Directory;
/**
* Gets the parent directory if it exists and was added to the project.
*/
getParent(): Directory | undefined;
/**
* Gets a child directory with the specified path or throws if not found.
* @param path - Relative path from this directory or absolute path.
*/
getDirectoryOrThrow(path: string): Directory;
/**
* Gets a child directory by the specified condition or throws if not found.
* @param condition - Condition to check the directory with.
*/
getDirectoryOrThrow(condition: (directory: Directory) => boolean): Directory;
/**
* Gets a directory with the specified path or undefined if not found.
* @param path - Relative path from this directory or absolute path.
*/
getDirectory(path: string): Directory | undefined;
/**
* Gets a child directory by the specified condition or undefined if not found.
* @param condition - Condition to check the directory with.
*/
getDirectory(condition: (directory: Directory) => boolean): Directory | undefined;
/**
* Gets a child source file with the specified path or throws if not found.
* @param path - Relative or absolute path to the file.
*/
getSourceFileOrThrow(path: string): SourceFile;
/**
* Gets a child source file by the specified condition or throws if not found.
* @param condition - Condition to check the source file with.
*/
getSourceFileOrThrow(condition: (sourceFile: SourceFile) => boolean): SourceFile;
/**
* Gets a child source file with the specified path or undefined if not found.
* @param path - Relative or absolute path to the file.
*/
getSourceFile(path: string): SourceFile | undefined;
/**
* Gets a child source file by the specified condition or undefined if not found.
* @param condition - Condition to check the source file with.
*/
getSourceFile(condition: (sourceFile: SourceFile) => boolean): SourceFile | undefined;
/**
* Gets the child directories.
*/
getDirectories(): Directory[];
/**
* Gets the source files within this directory.
*/
getSourceFiles(): SourceFile[];
/**
* Gets the source files in the current directory and all the descendant directories.
*/
getDescendantSourceFiles(): SourceFile[];
/**
* Gets the descendant directories.
*/
getDescendantDirectories(): Directory[];
/**
* Add source files based on file globs.
* @param fileGlobs - File glob or globs to add files based on.
* @returns The matched source files.
*/
addExistingSourceFiles(fileGlobs: string | ReadonlyArray<string>): SourceFile[];
/**
* Adds an existing directory from the relative path or directory name, or returns undefined if it doesn't exist.
*
* Will return the directory if it was already added.
* @param dirPath - Directory name or path to the directory that should be added.
* @param options - Options.
*/
addExistingDirectoryIfExists(dirPath: string, options?: DirectoryAddOptions): Directory | undefined;
/**
* Adds an existing directory from the relative path or directory name, or throws if it doesn't exist.
*
* Will return the directory if it was already added.
* @param dirPath - Directory name or path to the directory that should be added.
* @throws DirectoryNotFoundError if the directory does not exist.
*/
addExistingDirectory(dirPath: string, options?: DirectoryAddOptions): Directory;
/**
* Creates a directory if it doesn't exist.
* @param dirPath - Relative or absolute path to the directory that should be created.
*/
createDirectory(dirPath: string): Directory;
/**
* Creates a source file, relative to this directory.
*
* Note: The file will not be created and saved to the file system until .save() is called on the source file.
* @param relativeFilePath - Relative file path of the source file to create.
* @param sourceFileText - Text, structure, or writer function to create the source file text with.
* @param options - Options.
* @throws - InvalidOperationError if a source file already exists at the provided file name.
*/
createSourceFile(relativeFilePath: string, sourceFileText?: string | SourceFileStructure | WriterFunction, options?: SourceFileCreateOptions): SourceFile;
/**
* Adds an existing source file, relative to this directory, or returns undefined.
*
* Will return the source file if it was already added.
* @param relativeFilePath - Relative file path to add.
*/
addExistingSourceFileIfExists(relativeFilePath: string): SourceFile | undefined;
/**
* Adds an existing source file, relative to this directory, or throws if it doesn't exist.
*
* Will return the source file if it was already added.
* @param relativeFilePath - Relative file path to add.
* @throws FileNotFoundError when the file doesn't exist.
*/
addExistingSourceFile(relativeFilePath: string): SourceFile;
/**
* Emits the files in the directory.
* @param options - Options for emitting.
*/
emit(options?: {
emitOnlyDtsFiles?: boolean;
outDir?: string;
declarationDir?: string;
}): Promise<DirectoryEmitResult>;
/**
* Emits the files in the directory synchronously.
*
* Remarks: This might be very slow compared to the asynchronous version if there are a lot of files.
* @param options - Options for emitting.
*/
emitSync(options?: {
emitOnlyDtsFiles?: boolean;
outDir?: string;
declarationDir?: string;
}): DirectoryEmitResult;
private _emitInternal;
/**
* Copies the directory to a subdirectory of the specified directory.
* @param dirPathOrDirectory Directory path or directory object to copy the directory to.
* @param options Options for copying.
* @returns The new copied directory.
*/
copyToDirectory(dirPathOrDirectory: string | Directory, options?: DirectoryCopyOptions): Directory;
/**
* Copies the directory to a new directory.
* @param relativeOrAbsolutePath - The relative or absolute path to the new directory.
* @param options - Options.
* @returns The directory the copy was made to.
*/
copy(relativeOrAbsolutePath: string, options?: DirectoryCopyOptions): Directory;
/**
* Immediately copies the directory to the specified path asynchronously.
* @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
* @param options - Options for moving the directory.
* @remarks If includeTrackedFiles is true, then it will execute the pending operations in the current directory.
*/
copyImmediately(relativeOrAbsolutePath: string, options?: DirectoryCopyOptions): Promise<Directory>;
/**
* Immediately copies the directory to the specified path synchronously.
* @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
* @param options - Options for moving the directory.
* @remarks If includeTrackedFiles is true, then it will execute the pending operations in the current directory.
*/
copyImmediatelySync(relativeOrAbsolutePath: string, options?: DirectoryCopyOptions): Directory;
/**
* Moves the directory to a subdirectory of the specified directory.
* @param dirPathOrDirectory Directory path or directory object to move the directory to.
* @param options Options for moving.
*/
moveToDirectory(dirPathOrDirectory: string | Directory, options?: DirectoryMoveOptions): this;
/**
* Moves the directory to a new path.
* @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
* @param options - Options for moving the directory.
*/
move(relativeOrAbsolutePath: string, options?: DirectoryMoveOptions): this;
/**
* Immediately moves the directory to a new path asynchronously.
* @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
* @param options - Options for moving the directory.
*/
moveImmediately(relativeOrAbsolutePath: string, options?: DirectoryMoveOptions): Promise<this>;
/**
* Immediately moves the directory to a new path synchronously.
* @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
* @param options - Options for moving the directory.
*/
moveImmediatelySync(relativeOrAbsolutePath: string, options?: DirectoryMoveOptions): this;
/**
* Queues a deletion of the directory to the file system.
*
* The directory will be deleted when calling ast.save(). If you wish to delete the file immediately, then use deleteImmediately().
*/
delete(): void;
/**
* Asyncronously deletes the directory and all its descendants from the file system.
*/
deleteImmediately(): Promise<void>;
/**
* Synchronously deletes the directory and all its descendants from the file system.
*/
deleteImmediatelySync(): void;
/**
* Forgets the directory and all its descendants from the Project.
*
* Note: Does not delete the directory from the file system.
*/
forget(): void;
/**
* Asynchronously saves the directory and all the unsaved source files to the disk.
*/
save(): Promise<void>;
/**
* Synchronously saves the directory and all the unsaved source files to the disk.
*/
saveSync(): void;
/**
* Gets the relative path to another source file.
* @param sourceFile - Source file.
*/
getRelativePathTo(sourceFile: SourceFile): string;
/**
* Gets the relative path to another directory.
* @param directory - Directory.
*/
getRelativePathTo(directory: Directory): string;
/**
* Gets the relative path to the specified source file as a module specifier.
* @param sourceFile - Source file.
*/
getRelativePathAsModuleSpecifierTo(sourceFile: SourceFile): string;
/**
* Gets the relative path to the specified directory as a module specifier.
* @param directory - Directory.
*/
getRelativePathAsModuleSpecifierTo(directory: Directory): string;
/**
* Gets if the directory was forgotten.
*/
wasForgotten(): boolean;
}
export interface DirectoryAddOptions {
/**
* Whether to also recursively add all the directory's descendant directories.
* @remarks Defaults to false.
*/
recursive?: boolean;
}
export interface DirectoryCopyOptions extends SourceFileCopyOptions {
/**
* Includes all the files in the directory and sub-directory when copying.
* @remarks - Defaults to true.
*/
includeUntrackedFiles?: boolean;
}
export declare class DirectoryEmitResult {
private readonly _emitSkipped;
private readonly _outputFilePaths;
private constructor();
/**
* Gets if the emit was skipped.
*/
getEmitSkipped(): boolean;
/**
* Gets the output file paths.
*/
getOutputFilePaths(): string[];
}
export interface DirectoryMoveOptions extends SourceFileMoveOptions {
}
export interface FileSystemHost {
delete(path: string): Promise<void>;
deleteSync(path: string): void;
readDirSync(dirPath: string): string[];
readFile(filePath: string, encoding?: string): Promise<string>;
readFileSync(filePath: string, encoding?: string): string;
writeFile(filePath: string, fileText: string): Promise<void>;
writeFileSync(filePath: string, fileText: string): void;
mkdir(dirPath: string): Promise<void>;
mkdirSync(dirPath: string): void;
move(srcPath: string, destPath: string): Promise<void>;
moveSync(srcPath: string, destPath: string): void;
copy(srcPath: string, destPath: string): Promise<void>;
copySync(srcPath: string, destPath: string): void;
fileExists(filePath: string): Promise<boolean>;
fileExistsSync(filePath: string): boolean;
directoryExists(dirPath: string): Promise<boolean>;
directoryExistsSync(dirPath: string): boolean;
getCurrentDirectory(): string;
glob(patterns: ReadonlyArray<string>): string[];
}
export interface ProjectOptions {
/** Compiler options */
compilerOptions?: CompilerOptions;
/** File path to the tsconfig.json file */
tsConfigFilePath?: string;
/** Whether to add the source files from the specified tsconfig.json or not. Defaults to true. */
addFilesFromTsConfig?: boolean;
/** Manipulation settings */
manipulationSettings?: Partial<ManipulationSettings>;
/** Skip resolving file dependencies when providing a ts config file path and adding the files from tsconfig. */
skipFileDependencyResolution?: boolean;
/** Whether to use a virtual file system. */
useVirtualFileSystem?: boolean;
/**
* Optional file system host. Useful for mocking access to the file system.
* @remarks Consider using `useVirtualFileSystem` instead.
*/
fileSystem?: FileSystemHost;
}
/**
* Project that holds source files.
*/
export declare class Project {
/**
* Initializes a new instance.
* @param options - Optional options.
*/
constructor(options?: ProjectOptions);
/** Gets the manipulation settings. */
readonly manipulationSettings: ManipulationSettingsContainer;
/** Gets the compiler options for modification. */
readonly compilerOptions: CompilerOptionsContainer;
/**
* Adds the source files the project's source files depend on to the project.
* @returns The added source files.
* @remarks
* * This should be done after source files are added to the project, preferably once to
* avoid doing more work than necessary.
* * This is done by default when creating a Project and providing a tsconfig.json and
* not specifying to not add the source files.
*/
resolveSourceFileDependencies(): SourceFile[];
/**
* Adds an existing directory from the path or returns undefined if it doesn't exist.
*
* Will return the directory if it was already added.
* @param dirPath - Path to add the directory at.
* @param options - Options.
*/
addExistingDirectoryIfExists(dirPath: string, options?: DirectoryAddOptions): Directory | undefined;
/**
* Adds an existing directory from the path or throws if it doesn't exist.
*
* Will return the directory if it was already added.
* @param dirPath - Path to add the directory at.
* @param options - Options.
* @throws DirectoryNotFoundError when the directory does not exist.
*/
addExistingDirectory(dirPath: string, options?: DirectoryAddOptions): Directory;
/**
* Creates a directory at the specified path.
* @param dirPath - Path to create the directory at.
*/
createDirectory(dirPath: string): Directory;
/**
* Gets a directory by the specified path or throws if it doesn't exist.
* @param dirPath - Path to create the directory at.
*/
getDirectoryOrThrow(dirPath: string): Directory;
/**
* Gets a directory by the specified path or returns undefined if it doesn't exist.
* @param dirPath - Directory path.
*/
getDirectory(dirPath: string): Directory | undefined;
/**
* Gets all the directories.
*/
getDirectories(): Directory[];
/**
* Gets the directories without a parent.
*/
getRootDirectories(): Directory[];
/**
* Adds source files based on file globs.
* @param fileGlobs - File glob or globs to add files based on.
* @returns The matched source files.
*/
addExistingSourceFiles(fileGlobs: string | ReadonlyArray<string>): SourceFile[];
/**
* Adds a source file from a file path if it exists or returns undefined.
*
* Will return the source file if it was already added.
* @param filePath - File path to get the file from.
*/
addExistingSourceFileIfExists(filePath: string): SourceFile | undefined;
/**
* Adds an existing source file from a file path or throws if it doesn't exist.
*
* Will return the source file if it was already added.
* @param filePath - File path to get the file from.
* @throws FileNotFoundError when the file is not found.
*/
addExistingSourceFile(filePath: string): SourceFile;
/**
* Adds all the source files from the specified tsconfig.json.
*
* Note that this is done by default when specifying a tsconfig file in the constructor and not explicitly setting the
* addFilesFromTsConfig option to false.
* @param tsConfigFilePath - File path to the tsconfig.json file.
*/
addSourceFilesFromTsConfig(tsConfigFilePath: string): SourceFile[];
/**
* Creates a source file at the specified file path with the specified text.
*
* Note: The file will not be created and saved to the file system until .save() is called on the source file.
* @param filePath - File path of the source file.
* @param sourceFileText - Text, structure, or writer function for the source file text.
* @param options - Options.
* @throws - InvalidOperationError if a source file already exists at the provided file path.
*/
createSourceFile(filePath: string, sourceFileText?: string | SourceFileStructure | WriterFunction, options?: SourceFileCreateOptions): SourceFile;
/**
* Removes a source file from the AST.
* @param sourceFile - Source file to remove.
* @returns True if removed.
*/
removeSourceFile(sourceFile: SourceFile): boolean;
/**
* Gets a source file by a file name or file path. Throws an error if it doesn't exist.
* @param fileNameOrPath - File name or path that the path could end with or equal.
*/
getSourceFileOrThrow(fileNameOrPath: string): SourceFile;
/**
* Gets a source file by a search function. Throws an erorr if it doesn't exist.
* @param searchFunction - Search function.
*/
getSourceFileOrThrow(searchFunction: (file: SourceFile) => boolean): SourceFile;
/**
* Gets a source file by a file name or file path. Returns undefined if none exists.
* @param fileNameOrPath - File name or path that the path could end with or equal.
*/
getSourceFile(fileNameOrPath: string): SourceFile | undefined;
/**
* Gets a source file by a search function. Returns undefined if none exists.
* @param searchFunction - Search function.
*/
getSourceFile(searchFunction: (file: SourceFile) => boolean): SourceFile | undefined;
/**
* Gets all the source files added to the project.
* @param globPattern - Glob pattern for filtering out the source files.
*/
getSourceFiles(): SourceFile[];
/**
* Gets all the source files added to the project that match a pattern.
* @param globPattern - Glob pattern for filtering out the source files.
*/
getSourceFiles(globPattern: string): SourceFile[];
/**
* Gets all the source files added to the project that match the passed in patterns.
* @param globPatterns - Glob patterns for filtering out the source files.
*/
getSourceFiles(globPatterns: ReadonlyArray<string>): SourceFile[];
/**
* Gets the specified ambient module symbol or returns undefined if not found.
* @param moduleName - The ambient module name with or without quotes.
*/
getAmbientModule(moduleName: string): Symbol | undefined;
/**
* Gets the specified ambient module symbol or throws if not found.
* @param moduleName - The ambient module name with or without quotes.
*/
getAmbientModuleOrThrow(moduleName: string): Symbol;
/**
* Gets the ambient module symbols (ex. modules in the @types folder or node_modules).
*/
getAmbientModules(): Symbol[];
/**
* Saves all the unsaved source files to the file system and deletes all deleted files.
*/
save(): Promise<void>;
/**
* Synchronously saves all the unsaved source files to the file system and deletes all deleted files.
*
* Remarks: This might be very slow compared to the asynchronous version if there are a lot of files.
*/
saveSync(): void;
/**
* Enables logging to the console.
* @param enabled - Enabled.
*/
enableLogging(enabled?: boolean): void;
private _getUnsavedSourceFiles;
/**
* Gets the pre-emit diagnostics.
*/
getPreEmitDiagnostics(): Diagnostic[];
/**
* Gets the language service.
*/
getLanguageService(): LanguageService;
/**
* Gets the program.
*/
getProgram(): Program;
/**
* Gets the type checker.
*/
getTypeChecker(): TypeChecker;
/**
* Gets the file system.
*/
getFileSystem(): FileSystemHost;
/**
* Emits all the source files.
* @param emitOptions - Optional emit options.
*/
emit(emitOptions?: EmitOptions): EmitResult;
/**
* Emits all the source files to memory.
* @param emitOptions - Optional emit options.
*/
emitToMemory(emitOptions?: EmitOptions): MemoryEmitResult;
/**
* Gets the compiler options.
*/
getCompilerOptions(): CompilerOptions;
/**
* Creates a writer with the current manipulation settings.
* @remarks Generally it's best to use a provided writer, but this may be useful in some scenarios.
*/
createWriter(): CodeBlockWriter;
/**
* Forgets the nodes created in the scope of the passed in block.
*
* This is an advanced method that can be used to easily "forget" all the nodes created within the scope of the block.
* @param block - Block of code to run.
*/
forgetNodesCreatedInBlock(block: (remember: (...node: Node[]) => void) => void): void;
/**
* Forgets the nodes created in the scope of the passed in block asynchronously.
*
* This is an advanced method that can be used to easily "forget" all the nodes created within the scope of the block.
* @param block - Block of code to run.
*/
forgetNodesCreatedInBlock(block: (remember: (...node: Node[]) => void) => Promise<void>): void;
/**
* Formats an array of diagnostics with their color and context into a string.
* @param diagnostics - Diagnostics to get a string of.
* @param options - Collection of options. For exmaple, the new line character to use (defaults to the OS' new line character).
*/
formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray<Diagnostic>, opts?: {
newLineChar?: "\n" | "\r\n";
}): string;
/**
* Applies the given file text changes to this project. This modifies and possibly creates new SourceFiles.
*
* WARNING: This will forget any previously navigated descendant nodes of changed files. It's best to do
* this when you're all done.
* @param fileTextChanges - Collections of file changes to apply to this project.
* @param options - Options for applying the text changes.
*/
applyFileTextChanges(fileTextChanges: ReadonlyArray<FileTextChanges>, options?: {
overwrite?: boolean;
}): void;
}
export interface SourceFileCreateOptions {
overwrite?: boolean;
}
export declare type Constructor<T> = new (...args: any[]) => T;
export declare type WriterFunction = (writer: CodeBlockWriter) => void;
/**
* Creates a wrapped node from a compiler node.
* @param node - Node to create a wrapped node from.
* @param info - Info for creating the wrapped node.
*/
export declare function createWrappedNode<T extends ts.Node = ts.Node>(node: T, opts?: CreateWrappedNodeOptions): CompilerNodeToWrappedType<T>;
export interface CreateWrappedNodeOptions {
/**
* Compiler options.
*/
compilerOptions?: CompilerOptions;
/**
* Optional source file of the node. Will make it not bother going up the tree to find the source file.
*/
sourceFile?: ts.SourceFile;
/**
* Type checker.
*/
typeChecker?: ts.TypeChecker;
}
/**
* Prints the provided node using the compiler's printer.
* @param node - Compiler node.
* @param options - Options.
* @remarks If the node was not constructed with the compiler API factory methods and the node
* does not have parents set, then use the other overload that accepts a source file.
*/
export declare function printNode(node: ts.Node, options?: PrintNodeOptions): string;
/**
* Prints the provided node using the compiler's printer.
* @param node - Compiler node.
* @param sourceFile - Compiler source file.
* @param options - Options.
*/
export declare function printNode(node: ts.Node, sourceFile: ts.SourceFile, options?: PrintNodeOptions): string;
/**
* Options for printing a node.
*/
export interface PrintNodeOptions {
/**
* Whether to remove comments or not.
*/
removeComments?: boolean;
/**
* New line kind.
*
* Defaults to line feed.
*/
newLineKind?: NewLineKind;
/**
* From the compiler api: "A value indicating the purpose of a node. This is primarily used to
* distinguish between an `Identifier` used in an expression position, versus an
* `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you
* should just pass `Unspecified`."
*
* Defaults to `Unspecified`.
*/
emitHint?: EmitHint;
/**
* The script kind.
*
* @remarks This is only useful when passing in a compiler node that was constructed
* with the compiler API factory methods.
*
* Defaults to TSX.
*/
scriptKind?: ScriptKind;
}
export declare type SourceFileReferencingNodes = ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration | CallExpression;
export interface CompilerOptionsFromTsConfigOptions {
encoding?: string;
fileSystem?: FileSystemHost;
}
export interface CompilerOptionsFromTsConfigResult {
options: CompilerOptions;
errors: Diagnostic[];
}
/**
* Gets the compiler options from a specified tsconfig.json
* @param filePath - File path to the tsconfig.json.
* @param options - Options.
*/
export declare function getCompilerOptionsFromTsConfig(filePath: string, options?: CompilerOptionsFromTsConfigOptions): CompilerOptionsFromTsConfigResult;
/**
* Type guards for checking the type of a node.
*/
export declare class TypeGuards {
private constructor();
/**
* Gets if the node has an expression.
* @param node - Node to check.
*/
static hasExpression(node: Node): node is Node & {
getExpression(): Expression;
};
/**
* Gets if the node has a name.
* @param node - Node to check.
*/
static hasName(node: Node): node is Node & {
getName(): string;
getNameNode(): Node;
};
/**
* Gets if the node has a body.
* @param node - Node to check.
*/
static hasBody(node: Node): node is Node & {
getBody(): Node;
};
/**
* Gets if the node is an AbstractableNode.
* @param node - Node to check.
*/
static isAbstractableNode(node: Node): node is AbstractableNode & AbstractableNodeExtensionType;
/**
* Gets if the node is an AmbientableNode.
* @param node - Node to check.
*/
static isAmbientableNode(node: Node): node is AmbientableNode & AmbientableNodeExtensionType;
/**
* Gets if the node is an AnyKeyword.
* @param node - Node to check.
*/
static isAnyKeyword(node: Node): node is Expression;
/**
* Gets if the node is an ArgumentedNode.
* @param node - Node to check.
*/
static isArgumentedNode(node: Node): node is ArgumentedNode & ArgumentedNodeExtensionType;
/**
* Gets if the node is an ArrayBindingPattern.
* @param node - Node to check.
*/
static isArrayBindingPattern(node: Node): node is ArrayBindingPattern;
/**
* Gets if the node is an ArrayLiteralExpression.
* @param node - Node to check.
*/
static isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression;
/**
* Gets if the node is an ArrayTypeNode.
* @param node - Node to check.
*/
static isArrayTypeNode(node: Node): node is ArrayTypeNode;
/**
* Gets if the node is an ArrowFunction.
* @param node - Node to check.
*/
static isArrowFunction(node: Node): node is ArrowFunction;
/**
* Gets if the node is an AsExpression.
* @param node - Node to check.
*/
static isAsExpression(node: Node): node is AsExpression;
/**
* Gets if the node is an AsyncableNode.
* @param node - Node to check.
*/
static isAsyncableNode(node: Node): node is AsyncableNode & AsyncableNodeExtensionType;
/**
* Gets if the node is an AwaitExpression.
* @param node - Node to check.
*/
static isAwaitExpression(node: Node): node is AwaitExpression;
/**
* Gets if the node is an AwaitableNode.
* @param node - Node to check.
*/
static isAwaitableNode(node: Node): node is AwaitableNode & AwaitableNodeExtensionType;
/**
* Gets if the node is a BinaryExpression.
* @param node - Node to check.
*/
static isBinaryExpression(node: Node): node is BinaryExpression;
/**
* Gets if the node is a BindingElement.
* @param node - Node to check.
*/
static isBindingElement(node: Node): node is BindingElement;
/**
* Gets if the node is a BindingNamedNode.
* @param node - Node to check.
*/
static isBindingNamedNode(node: Node): node is BindingNamedNode & BindingNamedNodeExtensionType;
/**
* Gets if the node is a Block.
* @param node - Node to check.
*/
static isBlock(node: Node): node is Block;
/**
* Gets if the node is a BodiedNode.
* @param node - Node to check.
*/
static isBodiedNode(node: Node): node is BodiedNode & BodiedNodeExtensionType;
/**
* Gets if the node is a BodyableNode.
* @param node - Node to check.
*/
static isBodyableNode(node: Node): node is BodyableNode & BodyableNodeExtensionType;
/**
* Gets if the node is a BooleanKeyword.
* @param node - Node to check.
*/
static isBooleanKeyword(node: Node): node is Expression;
/**
* Gets if the node is a BooleanLiteral.
* @param node - Node to check.
*/
static isBooleanLiteral(node: Node): node is BooleanLiteral;
/**
* Gets if the node is a BreakStatement.
* @param node - Node to check.
*/
static isBreakStatement(node: Node): node is BreakStatement;
/**
* Gets if the node is a CallExpression.
* @param node - Node to check.
*/
static isCallExpression(node: Node): node is CallExpression;
/**
* Gets if the node is a CallSignatureDeclaration.
* @param node - Node to check.
*/
static isCallSignatureDeclaration(node: Node): node is CallSignatureDeclaration;
/**
* Gets if the node is a CaseBlock.
* @param node - Node to check.
*/
static isCaseBlock(node: Node): node is CaseBlock;
/**
* Gets if the node is a CaseClause.
* @param node - Node to check.
*/
static isCaseClause(node: Node): node is CaseClause;
/**
* Gets if the node is a CatchClause.
* @param node - Node to check.
*/
static isCatchClause(node: Node): node is CatchClause;
/**
* Gets if the node is a ChildOrderableNode.
* @param node - Node to check.
*/
static isChildOrderableNode(node: Node): node is ChildOrderableNode & ChildOrderableNodeExtensionType;
/**
* Gets if the node is a ClassDeclaration.
* @param node - Node to check.
*/
static isClassDeclaration(node: Node): node is ClassDeclaration;
/**
* Gets if the node is a ClassExpression.
* @param node - Node to check.
*/
static isClassExpression(node: Node): node is ClassExpression;
/**
* Gets if the node is a ClassLikeDeclarationBase.
* @param node - Node to check.
*/
static isClassLikeDeclarationBase(node: Node): node is ClassLikeDeclarationBase & ClassLikeDeclarationBaseExtensionType;
/**
* Gets if the node is a CommaListExpression.
* @param node - Node to check.
*/
static isCommaListExpression(node: Node): node is CommaListExpression;
/**
* Gets if the node is a ComputedPropertyName.
* @param node - Node to check.
*/
static isComputedPropertyName(node: Node): node is ComputedPropertyName;
/**
* Gets if the node is a ConditionalExpression.
* @param node - Node to check.
*/
static isConditionalExpression(node: Node): node is ConditionalExpression;
/**
* Gets if the node is a ConstructSignatureDeclaration.
* @param node - Node to check.
*/
static isConstructSignatureDeclaration(node: Node): node is ConstructSignatureDeclaration;
/**
* Gets if the node is a ConstructorDeclaration.
* @param node - Node to check.
*/
static isConstructorDeclaration(node: Node): node is ConstructorDeclaration;
/**
* Gets if the node is a ConstructorTypeNode.
* @param node - Node to check.
*/
static isConstructorTypeNode(node: Node): node is ConstructorTypeNode;
/**
* Gets if the node is a ContinueStatement.
* @param node - Node to check.
*/
static isContinueStatement(node: Node): node is ContinueStatement;
/**
* Gets if the node is a DebuggerStatement.
* @param node - Node to check.
*/
static isDebuggerStatement(node: Node): node is DebuggerStatement;
/**
* Gets if the node is a DeclarationNamedNode.
* @param node - Node to check.
*/
static isDeclarationNamedNode(node: Node): node is DeclarationNamedNode & DeclarationNamedNodeExtensionType;
/**
* Gets if the node is a DecoratableNode.
* @param node - Node to check.
*/
static isDecoratableNode(node: Node): node is DecoratableNode & DecoratableNodeExtensionType;
/**
* Gets if the node is a Decorator.
* @param node - Node to check.
*/
static isDecorator(node: Node): node is Decorator;
/**
* Gets if the node is a DefaultClause.
* @param node - Node to check.
*/
static isDefaultClause(node: Node): node is DefaultClause;
/**
* Gets if the node is a DeleteExpression.
* @param node - Node to check.
*/
static isDeleteExpression(node: Node): node is DeleteExpression;
/**
* Gets if the node is a DoStatement.
* @param node - Node to check.
*/
static isDoStatement(node: Node): node is DoStatement;
/**
* Gets if the node is an ElementAccessExpression.
* @param node - Node to check.
*/
static isElementAccessExpression(node: Node): node is ElementAccessExpression;
/**
* Gets if the node is an EmptyStatement.
* @param node - Node to check.
*/
static isEmptyStatement(node: Node): node is EmptyStatement;
/**
* Gets if the node is an EnumDeclaration.
* @param node - Node to check.
*/
static isEnumDeclaration(node: Node): node is EnumDeclaration;
/**
* Gets if the node is an EnumMember.
* @param node - Node to check.
*/
static isEnumMember(node: Node): node is EnumMember;
/**
* Gets if the node is an ExclamationTokenableNode.
* @param node - Node to check.
*/
static isExclamationTokenableNode(node: Node): node is ExclamationTokenableNode & ExclamationTokenableNodeExtensionType;
/**
* Gets if the node is an ExportAssignment.
* @param node - Node to check.
*/
static isExportAssignment(node: Node): node is ExportAssignment;
/**
* Gets if the node is an ExportDeclaration.
* @param node - Node to check.
*/
static isExportDeclaration(node: Node): node is ExportDeclaration;
/**
* Gets if the node is an ExportSpecifier.
* @param node - Node to check.
*/
static isExportSpecifier(node: Node): node is ExportSpecifier;
/**
* Gets if the node is an ExportableNode.
* @param node - Node to check.
*/
static isExportableNode(node: Node): node is ExportableNode & ExportableNodeExtensionType;
/**
* Gets if the node is an Expression.
* @param node - Node to check.
*/
static isExpression(node: Node): node is Expression;
/**
* Gets if the node is an ExpressionStatement.
* @param node - Node to check.
*/
static isExpressionStatement(node: Node): node is ExpressionStatement;
/**
* Gets if the node is an ExpressionWithTypeArguments.
* @param node - Node to check.
*/
static isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments;
/**
* Gets if the node is an ExpressionedNode.
* @param node - Node to check.
*/
static isExpressionedNode(node: Node): node is ExpressionedNode & ExpressionedNodeExtensionType;
/**
* Gets if the node is an ExtendsClauseableNode.
* @param node - Node to check.
*/
static isExtendsClauseableNode(node: Node): node is ExtendsClauseableNode & ExtendsClauseableNodeExtensionType;
/**
* Gets if the node is an ExternalModuleReference.
* @param node - Node to check.
*/
static isExternalModuleReference(node: Node): node is ExternalModuleReference;
/**
* Gets if the node is a FalseKeyword.
* @param node - Node to check.
*/
static isFalseKeyword(node: Node): node is BooleanLiteral;
/**
* Gets if the node is a ForInStatement.
* @param node - Node to check.
*/
static isForInStatement(node: Node): node is ForInStatement;
/**
* Gets if the node is a ForOfStatement.
* @param node - Node to check.
*/
static isForOfStatement(node: Node): node is ForOfStatement;
/**
* Gets if the node is a ForStatement.
* @param node - Node to check.
*/
static isForStatement(node: Node): node is ForStatement;
/**
* Gets if the node is a FunctionDeclaration.
* @param node - Node to check.
*/
static isFunctionDeclaration(node: Node): node is FunctionDeclaration;
/**
* Gets if the node is a FunctionExpression.
* @param node - Node to check.
*/
static isFunctionExpression(node: Node): node is FunctionExpression;
/**
* Gets if the node is a FunctionLikeDeclaration.
* @param node - Node to check.
*/
static isFunctionLikeDeclaration(node: Node): node is FunctionLikeDeclaration & FunctionLikeDeclarationExtensionType;
/**
* Gets if the node is a FunctionOrConstructorTypeNodeBase.
* @param node - Node to check.
*/
static isFunctionOrConstructorTypeNodeBase(node: Node): node is FunctionOrConstructorTypeNodeBase;
/**
* Gets if the node is a FunctionTypeNode.
* @param node - Node to check.
*/
static isFunctionTypeNode(node: Node): node is FunctionTypeNode;
/**
* Gets if the node is a GeneratorableNode.
* @param node - Node to check.
*/
static isGeneratorableNode(node: Node): node is GeneratorableNode & GeneratorableNodeExtensionType;
/**
* Gets if the node is a GetAccessorDeclaration.
* @param node - Node to check.
*/
static isGetAccessorDeclaration(node: Node): node is GetAccessorDeclaration;
/**
* Gets if the node is a HeritageClause.
* @param node - Node to check.
*/
static isHeritageClause(node: Node): node is HeritageClause;
/**
* Gets if the node is a HeritageClauseableNode.
* @param node - Node to check.
*/
static isHeritageClauseableNode(node: Node): node is HeritageClauseableNode & HeritageClauseableNodeExtensionType;
/**
* Gets if the node is a Identifier.
* @param node - Node to check.
*/
static isIdentifier(node: Node): node is Identifier;
/**
* Gets if the node is a IfStatement.
* @param node - Node to check.
*/
static isIfStatement(node: Node): node is IfStatement;
/**
* Gets if the node is a ImplementsClauseableNode.
* @param node - Node to check.
*/
static isImplementsClauseableNode(node: Node): node is ImplementsClauseableNode & ImplementsClauseableNodeExtensionType;
/**
* Gets if the node is a ImportClause.
* @param node - Node to check.
*/
static isImportClause(node: Node): node is ImportClause;
/**
* Gets if the node is a ImportDeclaration.
* @param node - Node to check.
*/
static isImportDeclaration(node: Node): node is ImportDeclaration;
/**
* Gets if the node is a ImportEqualsDeclaration.
* @param node - Node to check.
*/
static isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration;
/**
* Gets if the node is a ImportExpression.
* @param node - Node to check.
*/
static isImportExpression(node: Node): node is ImportExpression;
/**
* Gets if the node is a ImportSpecifier.
* @param node - Node to check.
*/
static isImportSpecifier(node: Node): node is ImportSpecifier;
/**
* Gets if the node is a ImportTypeNode.
* @param node - Node to check.
*/
static isImportTypeNode(node: Node): node is ImportTypeNode;
/**
* Gets if the node is a IndexSignatureDeclaration.
* @param node - Node to check.
*/
static isIndexSignatureDeclaration(node: Node): node is IndexSignatureDeclaration;
/**
* Gets if the node is a InitializerExpressionableNode.
* @param node - Node to check.
*/
static isInitializerExpressionableNode(node: Node): node is InitializerExpressionableNode & InitializerExpressionableNodeExtensionType;
/**
* Gets if the node is a InitializerGetExpressionableNode.
* @param node - Node to check.
*/
static isInitializerGetExpressionableNode(node: Node): node is InitializerGetExpressionableNode & InitializerGetExpressionableNodeExtensionType;
/**
* Gets if the node is a InitializerSetExpressionableNode.
* @param node - Node to check.
*/
static isInitializerSetExpressionableNode(node: Node): node is InitializerSetExpressionableNode & InitializerSetExpressionableNodeExtensionType;
/**
* Gets if the node is a InterfaceDeclaration.
* @param node - Node to check.
*/
static isInterfaceDeclaration(node: Node): node is InterfaceDeclaration;
/**
* Gets if the node is a IntersectionTypeNode.
* @param node - Node to check.
*/
static isIntersectionTypeNode(node: Node): node is IntersectionTypeNode;
/**
* Gets if the node is a IterationStatement.
* @param node - Node to check.
*/
static isIterationStatement(node: Node): node is IterationStatement;
/**
* Gets if the node is a JSDoc.
* @param node - Node to check.
*/
static isJSDoc(node: Node): node is JSDoc;
/**
* Gets if the node is a JSDocAugmentsTag.
* @param node - Node to check.
*/
static isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
/**
* Gets if the node is a JSDocClassTag.
* @param node - Node to check.
*/
static isJSDocClassTag(node: Node): node is JSDocClassTag;
/**
* Gets if the node is a JSDocParameterTag.
* @param node - Node to check.
*/
static isJSDocParameterTag(node: Node): node is JSDocParameterTag;
/**
* Gets if the node is a JSDocPropertyLikeTag.
* @param node - Node to check.
*/
static isJSDocPropertyLikeTag(node: Node): node is JSDocPropertyLikeTag & JSDocPropertyLikeTagExtensionType;
/**
* Gets if the node is a JSDocPropertyTag.
* @param node - Node to check.
*/
static isJSDocPropertyTag(node: Node): node is JSDocPropertyTag;
/**
* Gets if the node is a JSDocReturnTag.
* @param node - Node to check.
*/
static isJSDocReturnTag(node: Node): node is JSDocReturnTag;
/**
* Gets if the node is a JSDocTag.
* @param node - Node to check.
*/
static isJSDocTag(node: Node): node is JSDocTag;
/**
* Gets if the node is a JSDocTypeTag.
* @param node - Node to check.
*/
static isJSDocTypeTag(node: Node): node is JSDocTypeTag;
/**
* Gets if the node is a JSDocTypedefTag.
* @param node - Node to check.
*/
static isJSDocTypedefTag(node: Node): node is JSDocTypedefTag;
/**
* Gets if the node is a JSDocUnknownTag.
* @param node - Node to check.
*/
static isJSDocUnknownTag(node: Node): node is JSDocUnknownTag;
/**
* Gets if the node is a JSDocableNode.
* @param node - Node to check.
*/
static isJSDocableNode(node: Node): node is JSDocableNode & JSDocableNodeExtensionType;
/**
* Gets if the node is a JsxAttribute.
* @param node - Node to check.
*/
static isJsxAttribute(node: Node): node is JsxAttribute;
/**
* Gets if the node is a JsxAttributedNode.
* @param node - Node to check.
*/
static isJsxAttributedNode(node: Node): node is JsxAttributedNode & JsxAttributedNodeExtensionType;
/**
* Gets if the node is a JsxClosingElement.
* @param node - Node to check.
*/
static isJsxClosingElement(node: Node): node is JsxClosingElement;
/**
* Gets if the node is a JsxClosingFragment.
* @param node - Node to check.
*/
static isJsxClosingFragment(node: Node): node is JsxClosingFragment;
/**
* Gets if the node is a JsxElement.
* @param node - Node to check.
*/
static isJsxElement(node: Node): node is JsxElement;
/**
* Gets if the node is a JsxExpression.
* @param node - Node to check.
*/
static isJsxExpression(node: Node): node is JsxExpression;
/**
* Gets if the node is a JsxFragment.
* @param node - Node to check.
*/
static isJsxFragment(node: Node): node is JsxFragment;
/**
* Gets if the node is a JsxOpeningElement.
* @param node - Node to check.
*/
static isJsxOpeningElement(node: Node): node is JsxOpeningElement;
/**
* Gets if the node is a JsxOpeningFragment.
* @param node - Node to check.
*/
static isJsxOpeningFragment(node: Node): node is JsxOpeningFragment;
/**
* Gets if the node is a JsxSelfClosingElement.
* @param node - Node to check.
*/
static isJsxSelfClosingElement(node: Node): node is JsxSelfClosingElement;
/**
* Gets if the node is a JsxSpreadAttribute.
* @param node - Node to check.
*/
static isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute;
/**
* Gets if the node is a JsxTagNamedNode.
* @param node - Node to check.
*/
static isJsxTagNamedNode(node: Node): node is JsxTagNamedNode & JsxTagNamedNodeExtensionType;
/**
* Gets if the node is a JsxText.
* @param node - Node to check.
*/
static isJsxText(node: Node): node is JsxText;
/**
* Gets if the node is a LabeledStatement.
* @param node - Node to check.
*/
static isLabeledStatement(node: Node): node is LabeledStatement;
/**
* Gets if the node is a LeftHandSideExpression.
* @param node - No