[I] DiagnosticCollector
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(diagnostic): voidAdd a diagnostic to the collection
Parameters
| Parameter | Type | Description |
|---|---|---|
diagnostic | Diagnostic | Diagnostic to add. |
Returns
void
pipe()
pipe<T>(result): TUnwrap the Diagnostic result, add all the diagnostics and return the data.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
result | DiagnosticResult<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
| Parameter | Type | Description |
|---|---|---|
value | T | Accessor value to return |
Returns
Example
return diagnostics.wrap(routes);