Helper object to collect diagnostics from function following the diagnostics accessor pattern(foo() => [T, Diagnostic[]])
Properties
Property | Modifier | Type |
---|
diagnostics | readonly | readonly Diagnostic [] |
Methods
add()
Add a diagnostic to the collection
Parameters
Parameter | Type | Description |
---|
diagnostic | Diagnostic | Diagnostic to add. |
Returns
void
join()
join<T>(result): DiagnosticResult<T>
Join the given result with the diagnostics in this collector.
Type Parameters
Parameters
Parameter | Type | Description |
---|
result | DiagnosticResult <T > | result to join with the diagnostics |
Returns
DiagnosticResult
<T
>
- the result with the combined diagnostics
pipe()
Unwrap the Diagnostic result, add all the diagnostics and return the data.
Type Parameters
Parameters
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
Parameters
Parameter | Type | Description |
---|
value | T | Accessor value to return |
Returns
DiagnosticResult
<T
>
Example
return diagnostics.wrap(routes);