UNPKG

1.73 kBTypeScriptView Raw
1import * as ts from 'typescript';
2import AngularCompilerOptions from './options';
3import { VinylFile } from './vinyl_file';
4/**
5 * Our interface to the TypeScript standard compiler.
6 * If you write an Angular compiler plugin for another build tool,
7 * you should implement a similar interface.
8 */
9export interface CompilerInterface {
10 readConfiguration(project: string | VinylFile, basePath: string, existingOptions?: ts.CompilerOptions): {
11 parsed: ts.ParsedCommandLine;
12 ngOptions: AngularCompilerOptions;
13 };
14 typeCheck(compilerHost: ts.CompilerHost, program: ts.Program): void;
15 emit(program: ts.Program): number;
16}
17export declare class UserError extends Error {
18 private _nativeError;
19 constructor(message: string);
20 message: string;
21 name: string;
22 stack: any;
23 toString(): string;
24}
25export declare function formatDiagnostics(diags: ts.Diagnostic[]): string;
26export declare function check(diags: ts.Diagnostic[]): void;
27export declare function validateAngularCompilerOptions(options: AngularCompilerOptions): ts.Diagnostic[];
28export declare class Tsc implements CompilerInterface {
29 private readFile;
30 private readDirectory;
31 private parseConfigHost;
32 constructor(readFile?: (path: string, encoding?: string) => string, readDirectory?: (path: string, extensions?: string[], exclude?: string[], include?: string[]) => string[]);
33 readConfiguration(project: string | VinylFile, basePath: string, existingOptions?: ts.CompilerOptions): {
34 parsed: ts.ParsedCommandLine;
35 ngOptions: any;
36 };
37 typeCheck(compilerHost: ts.CompilerHost, program: ts.Program): void;
38 emit(program: ts.Program): number;
39}
40export declare const tsc: CompilerInterface;