TypeshadeDiagnostic
On this page

TypeshadeDiagnostic

Interface in Editor

Compiler diagnostic enriched with the source range and span that produced it.

import type { TypeshadeDiagnostic } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

interface TypeshadeDiagnostic {
readonly message: string;
readonly category: 'error' | 'warning' | 'message';
readonly code?: string;
readonly fileName: string;
readonly range: TypeshadeRange;
readonly span: TypeshadeTextSpan;
}

Description

span/range come directly from the compiler’s own start/length (see TsCompilerDiagnostic in src/compiler/ts/source-file.ts), which already cover the offending node — node.getStart(sourceFile) through node.getEnd() — or the file’s first statement when the diagnostic has no node behind it. Nothing here recomputes a one-character span from line/character any more.

Instance properties

messageread only string

Human-readable diagnostic message.

categoryread only 'error' | 'warning' | 'message'

Diagnostic severity.

codeoptionalread only string

Compiler-specific diagnostic code, when the diagnostic carries one.

fileNameread only string

Name of the source file the diagnostic was raised against.

rangeread only TypeshadeRange

Zero-based half-open range the diagnostic covers.

spanread only TypeshadeTextSpan

UTF-16 offset span the diagnostic covers, equivalent to range.

Source

src/language-service.ts, line 50, at commit 26de7be8

Edit this page Report a problem