Variable: errors()
readonlyerrors: <T,E>(results) =>E[]
Defined in: core/factories.ts:770
Extracts only the errors from an array of Results.
Filters and returns only the errors from Results that are Err, discarding successes. Useful when you want to analyze or log only the failures that occurred.
Type Parameters
T
T
Success value type
E
E
Error type
Parameters
results
readonly Result<T, E>[]
Array of Results
Returns
E[]
Array containing only errors
Examples
ts
// Extracting errors
const failures = Result.errors([
Result.ok(1),
Result.err('fail A'),
Result.ok(2),
Result.err('fail B')
])
// ["fail A", "fail B"]ts
// Empty array
Result.errors([]) // []