9 lines
205 B
TypeScript
9 lines
205 B
TypeScript
import type { DesktopResult } from "@shared/contracts";
|
|
|
|
export function unwrap<T>(result: DesktopResult<T>): T {
|
|
if (!result.ok) {
|
|
throw new Error(result.error.message);
|
|
}
|
|
return result.data;
|
|
}
|