These<E, A> = Err<E> | Ok<A> | Both<E, A>
Defined in: Core/These.ts:23
These<E, A> is an inclusive-OR type: it holds an error value (E), a success
value (A), or both simultaneously. It reuses Ok and Err from Result,
adding a third Both<E, A> variant for partial success with a warning/error.
- Err(e) — only an error/warning (no success value)
- Ok(a) — only a success value (no error)
- Both(e, a) — a warning together with a success value
E
A
const parse = (s: string): These<string, number> => {
const n = parseFloat(s.trim());
if (isNaN(n)) return These.err("Not a number");
if (s !== s.trim()) return These.both("Leading/trailing whitespace trimmed", n);
return These.ok(n);
};