UNPKG

1.85 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.dev/license
7 */
8import ts from 'typescript';
9import { ErrorCode } from './error_code';
10export declare class FatalDiagnosticError extends Error {
11 readonly code: ErrorCode;
12 readonly node: ts.Node;
13 readonly diagnosticMessage: string | ts.DiagnosticMessageChain;
14 readonly relatedInformation?: ts.DiagnosticRelatedInformation[] | undefined;
15 constructor(code: ErrorCode, node: ts.Node, diagnosticMessage: string | ts.DiagnosticMessageChain, relatedInformation?: ts.DiagnosticRelatedInformation[] | undefined);
16 message: never;
17 toDiagnostic(): ts.DiagnosticWithLocation;
18}
19export declare function makeDiagnostic(code: ErrorCode, node: ts.Node, messageText: string | ts.DiagnosticMessageChain, relatedInformation?: ts.DiagnosticRelatedInformation[], category?: ts.DiagnosticCategory): ts.DiagnosticWithLocation;
20export declare function makeDiagnosticChain(messageText: string, next?: ts.DiagnosticMessageChain[]): ts.DiagnosticMessageChain;
21export declare function makeRelatedInformation(node: ts.Node, messageText: string): ts.DiagnosticRelatedInformation;
22export declare function addDiagnosticChain(messageText: string | ts.DiagnosticMessageChain, add: ts.DiagnosticMessageChain[]): ts.DiagnosticMessageChain;
23export declare function isFatalDiagnosticError(err: any): err is FatalDiagnosticError;
24/**
25 * Whether the compiler diagnostics represents an error related to local compilation mode.
26 *
27 * This helper has application in 1P where we check whether a diagnostic is related to local
28 * compilation in order to add some g3 specific info to it.
29 */
30export declare function isLocalCompilationDiagnostics(diagnostic: ts.Diagnostic): boolean;