import { EventEmitter } from "node:events"; export interface Diagnostic extends DiagnosticLocationPair { readonly type: T; readonly details: Diagnostic.Details; readonly filename?: string; readonly source?: string; } export declare namespace Diagnostic { enum Type { InvalidJsonData = "invalid-json-data", InvalidJsonPartName = "invalid-json-part-name", MixedContent = "mixed-content", InvalidTAttribute = "invalid-t-attribute", UnlocalizedText = "unlocalized-text", DisallowedTAttribute = "disallowed-t-attribute", DisallowedContent = "disallowed-content", DisallowedLocalizedAttribute = "disallowed-localized-attribute", WrongPrefix = "wrong-prefix", DuplicateKeyOrPath = "duplicate-key-or-path", DuplicateKey = "duplicate-key", OutdatedTranslation = "outdated-translation", MissingTranslation = "missing-translation", ModifiedSource = "modified-source", ModifiedTranslation = "modified-translation", UnknownLocale = "unknown-locale" } type Details = { [Type.InvalidJsonData]: { path: string[]; }; [Type.InvalidJsonPartName]: { path: string[]; }; [Type.MixedContent]: {}; [Type.InvalidTAttribute]: { error: unknown; }; [Type.UnlocalizedText]: {}; [Type.DisallowedTAttribute]: {}; [Type.DisallowedContent]: {}; [Type.DisallowedLocalizedAttribute]: { key: string; name: string; }; [Type.WrongPrefix]: { key: string; expectedPrefix: string; }; [Type.DuplicateKeyOrPath]: { path: string[]; }; [Type.DuplicateKey]: { key: string; }; [Type.OutdatedTranslation]: { key: string; localeId: string; }; [Type.MissingTranslation]: { key: string; localeId: string; }; [Type.ModifiedSource]: {}; [Type.ModifiedTranslation]: {}; [Type.UnknownLocale]: { key: string; localeId: string; }; }[T]; const TYPES: Set; } export interface DiagnosticLocation { readonly offset: number; readonly line: number; readonly col: number; } export interface DiagnosticLocationPair { readonly start?: DiagnosticLocation; readonly end?: DiagnosticLocation; } export declare interface Diagnostics { on(event: "report", listener: (diagnostic: Diagnostic) => void): this; on(event: string | symbol, listener: (...args: any[]) => void): this; } export declare class Diagnostics extends EventEmitter { report(diagnostic: Diagnostic): void; } export declare class DiagnosticFormatter { #private; constructor(options?: DiagnosticFormatterOptions); /** * See {@link DiagnosticFormatterOptions.color} */ color: boolean; /** * See {@link DiagnosticFormatterOptions.context} */ context?: string; format(diagnostic: Diagnostic): string; } export interface DiagnosticFormatterOptions { /** * If true (default), formatted output is colored. */ color?: boolean; /** * Optional absolute path to omit from formatted file paths. */ context?: string; }