Discriminated union result type for pipeline stages. The ok discriminant guarantees TypeScript can narrow to exactly one branch โ ok: true always carries value: T and never error; ok: false always carries error and never value. This prevents impossible states such as { ok: true, error: 'โฆ' } and eliminates the need for non-null assertions in well-typed consumers.
Discriminated union result type for pipeline stages. The
okdiscriminant guarantees TypeScript can narrow to exactly one branch โok: truealways carriesvalue: Tand nevererror;ok: falsealways carrieserrorand nevervalue. This prevents impossible states such as{ ok: true, error: 'โฆ' }and eliminates the need for non-null assertions in well-typed consumers.