diff --git a/src/shared/core/Result.ts b/src/shared/core/Result.ts index 11d16dca..0077fd4d 100644 --- a/src/shared/core/Result.ts +++ b/src/shared/core/Result.ts @@ -21,6 +21,10 @@ export class Ok { public isErr(): this is Err { return false; } + + public unwrap(): T { + return this.value; + } } /** @@ -44,6 +48,10 @@ export class Err { public isErr(): this is Err { return true; } + + public unwrap(): T { + throw this.error; + } } /** @@ -91,7 +99,6 @@ export const combine = (results: Result[]): Result => { return ok(values); }; - // --- Either Type (kept separate for now) --- export type Either = Left | Right;