ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
55 lines (54 loc) • 1.49 kB
TypeScript
import * as ts from "typescript";
import { TypeChecker } from "./TypeChecker";
import { SourceFile } from "./../file";
import { EmitResult, Diagnostic } from "./results";
/**
* Options for emitting.
*/
export interface EmitOptions {
/**
* Optional source file to only emit.
*/
targetSourceFile?: SourceFile;
/**
* Whether only .d.ts files should be emitted.
*/
emitOnlyDtsFiles?: boolean;
}
/**
* Wrapper around Program.
*/
export declare class Program {
/**
* Gets the underlying compiler program.
*/
readonly compilerObject: ts.Program;
/**
* Get the program's type checker.
*/
getTypeChecker(): TypeChecker;
/**
* Emits the TypeScript files to the specified target.
*/
emit(options?: EmitOptions): EmitResult;
/**
* Gets the syntactic diagnostics.
* @param sourceFile - Optional source file.
*/
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
/**
* Gets the semantic diagnostics.
* @param sourceFile - Optional source file.
*/
getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
/**
* Gets the declaration diagnostics.
* @param sourceFile - Optional source file.
*/
getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[];
/**
* Gets the pre-emit diagnostics.
* @param sourceFile - Source file.
*/
getPreEmitDiagnostics(sourceFile?: SourceFile): Diagnostic[];
}