Skip to content

[I] DiagnosticCollector

Helper object to collect diagnostics from function following the diagnostics accessor pattern(foo() => [T, Diagnostic[]])

PropertyModifierType
diagnosticsreadonlyreadonly Diagnostic[]
add(diagnostic): void;

Add a diagnostic to the collection

ParameterTypeDescription
diagnosticDiagnosticDiagnostic to add.

void


join<T>(result): DiagnosticResult<T>;

Join the given result with the diagnostics in this collector.

Type Parameter
T
ParameterTypeDescription
resultDiagnosticResult<T>result to join with the diagnostics

DiagnosticResult<T>

  • the result with the combined diagnostics

pipe<T>(result): T;

Unwrap the Diagnostic result, add all the diagnostics and return the data.

Type Parameter
T
ParameterTypeDescription
resultDiagnosticResult<T>Accessor diagnostic result

T


wrap<T>(value): DiagnosticResult<T>;

Wrap the given value in a tuple including the diagnostics following the TypeSpec accessor pattern.

Type Parameter
T
ParameterTypeDescription
valueTAccessor value to return

DiagnosticResult<T>

return diagnostics.wrap(routes);