analysis_context.ts view source
Context for collecting diagnostics during source analysis.
Thread an instance through analysis functions to collect errors and warnings
without halting analysis. After analysis completes, check has_errors() and
report collected diagnostics.
examples
Example 1
diagnostics
type Array<Diagnostic>
add
Add a diagnostic to the collection.
type (diagnostic: Diagnostic): void
diagnostic
voidhas_errors
Check if any errors were collected.
type (): boolean
booleanhas_warnings
Check if any warnings were collected.
type (): boolean
booleanerrors
Get all error diagnostics.
type (): Diagnostic[]
Diagnostic[]warnings
Get all warning diagnostics.
type (): Diagnostic[]
Diagnostic[]by_kind
Get diagnostics of a specific kind.
type <K extends DiagnosticKind>(kind: K): (Extract<TypeExtractionDiagnostic, { kind: K; }> | Extract<SignatureAnalysisDiagnostic, { ...; }> | Extract<...> | Extract<...> | Extract<...>)[]
kind
K(Extract<TypeExtractionDiagnostic, { kind: K; }> | Extract<SignatureAnalysisDiagnostic, { kind: K; }> | Extract<...> | Extract<...> | Extract<...>)[]