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