import type { DiagnosticCode, DiagnosticValues, PlaceholderValue, Severity, Stage } from '../catalogue/index.js'; import type { Span } from '../span/index.js'; /** * One thing the compiler has to say about one place in a file. * * The code and the span come from the stage that raised it. Everything else * comes from the catalogue, filled with the values the stage supplied, so no * stage anywhere writes a sentence a reader sees. */ export interface Diagnostic { readonly code: DiagnosticCode; readonly severity: Severity; readonly stage: Stage; readonly title: string; /** The catalogue message with its slots filled. */ readonly message: string; /** The catalogue fix with its slots filled. What to do, in the imperative. */ readonly fix: string; /** Whether an editor may apply the fix without asking a question. */ readonly autofix: boolean; readonly span: Span; /** * The values that filled the slots, kept rather than discarded. * * An editor building a quick fix needs the name that went into the message, * not the sentence it was put into, and a host rendering a diagnostic in * another language needs every value the template consumed. */ readonly values: Readonly>; } /** * Builds a diagnostic. * * The values argument is typed per code, so a call site that forgets a slot or * misspells one fails to compile. That is the only guard that runs before a * trader sees the message, which is why the placeholders are generated as types. */ export declare function diagnosticFor(code: Code, span: Span, values: DiagnosticValues[Code]): Diagnostic; export declare function isError(diagnostic: Diagnostic): boolean; //# sourceMappingURL=diagnostic.d.ts.map