import { GraphQLError, Location, Source } from "graphql"; import * as ts from "typescript"; import { Result } from "./Result.js"; export type FixableDiagnostic = ts.Diagnostic & { fix?: ts.CodeFixAction; }; export type FixableDiagnosticWithLocation = ts.DiagnosticWithLocation & { fix?: ts.CodeFixAction; }; export type DiagnosticResult = Result; export type DiagnosticsResult = Result; export type DiagnosticsWithoutLocationResult = Result; export declare class ReportableDiagnostics { _host: ts.FormatDiagnosticsHost; _diagnostics: FixableDiagnostic[]; constructor(host: ts.FormatDiagnosticsHost, diagnostics: FixableDiagnostic[]); static fromDiagnostics(diagnostics: ts.Diagnostic[]): ReportableDiagnostics; formatDiagnosticsWithColorAndContext(): string; formatDiagnosticsWithContext(): string; } export declare const FAKE_ERROR_CODE = 1038; export declare function graphQlErrorToDiagnostic(error: GraphQLError): ts.Diagnostic; export declare function locationlessErr(message: string): ts.Diagnostic; export declare function gqlErr(item: { loc?: Location; }, message: string, relatedInformation?: ts.DiagnosticRelatedInformation[]): ts.DiagnosticWithLocation; export declare function gqlRelated(item: { loc?: Location; }, message: string): ts.DiagnosticRelatedInformation; export declare function rangeErr(file: ts.SourceFile, commentRange: ts.CommentRange, message: string, relatedInformation?: ts.DiagnosticRelatedInformation[], fix?: ts.CodeFixAction): FixableDiagnosticWithLocation; /** * A generic version of the methods on ts.Node that we need * to create diagnostics. * * This interface allows us to create diagnostics from our * own classes. */ export interface TsLocatableNode { getStart(): number; getEnd(): number; getSourceFile(): ts.SourceFile; } export declare function tsErr(node: TsLocatableNode, message: string, relatedInformation?: ts.DiagnosticRelatedInformation[], fix?: ts.CodeFixAction): FixableDiagnosticWithLocation; export declare function tsRelated(node: ts.Node, message: string): ts.DiagnosticRelatedInformation; export declare function diagnosticsMessage(messageText: string): ts.Diagnostic; export declare function graphqlSourceToSourceFile(source: Source): ts.SourceFile;