UNPKG

1.02 kBTypeScriptView Raw
1import { Location, DiagnosticLevel } from '../shared/types';
2export interface CompilerDiagnosticOrigin {
3 filename?: string;
4 location?: Location;
5}
6export interface CompilerDiagnostic {
7 message: string;
8 code: number;
9 filename?: string;
10 location?: Location;
11 level: DiagnosticLevel;
12}
13export declare class CompilerError extends Error implements CompilerDiagnostic {
14 code: number;
15 filename?: string;
16 location?: Location;
17 level: DiagnosticLevel;
18 constructor(code: number, message: string, filename?: string, location?: Location);
19 static from(diagnostic: CompilerDiagnostic, origin?: CompilerDiagnosticOrigin): CompilerError;
20 toDiagnostic(): CompilerDiagnostic;
21}
22export declare function getCodeFromError(error: any): number | undefined;
23export declare function getFilename(origin: CompilerDiagnosticOrigin | undefined, obj?: any): string | undefined;
24export declare function getLocation(origin: CompilerDiagnosticOrigin | undefined, obj?: any): Location | undefined;