Skip to content

[I] DiagnosticCollector

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

Properties

PropertyModifierType
diagnosticsreadonlyreadonly Diagnostic[]

Methods

add()

add(diagnostic): void

Add a diagnostic to the collection

Parameters

ParameterTypeDescription
diagnosticDiagnosticDiagnostic to add.

Returns

void


pipe()

pipe<T>(result): T

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

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
resultDiagnosticResult<T>Accessor diagnostic result

Returns

T


wrap()

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

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

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
valueTAccessor value to return

Returns

DiagnosticResult<T>

Example

return diagnostics.wrap(routes);