UNPKG

@angular/compiler-cli

Version:
30 lines (29 loc) • 1.38 kB
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { ErrorCode } from './error_code'; /** * During formatting of `ts.Diagnostic`s, the numeric code of each diagnostic is prefixed with the * hard-coded "TS" prefix. For Angular's own error codes, a prefix of "NG" is desirable. To achieve * this, all Angular error codes start with "-99" so that the sequence "TS-99" can be assumed to * correspond with an Angular specific error code. This function replaces those occurrences with * just "NG". * * @param errors The formatted diagnostics */ export declare function replaceTsWithNgInErrors(errors: string): string; export declare function ngErrorCode(code: ErrorCode): number; export declare function formatCompilerErrorCode(code: number): string; /** * Given a raw TypeScript diagnostic code, returns the corresponding {@link ErrorCode} if it is a * negative Angular error code that has an associated error guide, or `null` otherwise. */ export declare function errorCodeWithGuideFromDiagnosticCode(code: number): ErrorCode | null; /** * Appends a "Find more at <url>" guide link to the message text of a diagnostic. */ export declare function addDiagnosticDetails(code: ErrorCode, messageText: string): string;