A social knowledge tool for researchers built on ATProto

feat: Add unwrap methods to Ok and Err classes

+8 -1
+8 -1
src/shared/core/Result.ts
··· 21 21 public isErr(): this is Err<T, E> { 22 22 return false; 23 23 } 24 + 25 + public unwrap(): T { 26 + return this.value; 27 + } 24 28 } 25 29 26 30 /** ··· 43 47 /** Type guard indicating failure */ 44 48 public isErr(): this is Err<T, E> { 45 49 return true; 50 + } 51 + 52 + public unwrap(): T { 53 + throw this.error; 46 54 } 47 55 } 48 56 ··· 90 98 // If no errors were found, return an Ok with the collected values 91 99 return ok<T[], E>(values); 92 100 }; 93 - 94 101 95 102 // --- Either Type (kept separate for now) --- 96 103