/** * Extract the value or throw if it's an error. * * @example * const user = unwrap(result) // throws if result is an error * console.log(user.name) * * @example With custom message * const user = unwrap(result, 'Failed to get user') */ export declare function unwrap(value: V, message?: string): Exclude; /** * Extract the value or return a fallback if it's an error. * * @example * const name = unwrapOr(result, 'Anonymous') * // If result is User, returns user * // If result is Error, returns 'Anonymous' */ export declare function unwrapOr(value: V, fallback: U): Exclude | U; /** * Pattern match on an errore value. * Handles both success and error cases. * * @example * const message = match(result, { * ok: user => `Hello, ${user.name}`, * err: error => `Failed: ${error.message}` * }) */ export declare function match(value: V, handlers: { ok: (v: Exclude) => R; err: (e: Extract) => R; }): R; /** * Partition an array of errore values into [successes, errors]. * * @example * const results = await Promise.all(ids.map(fetchUser)) * const [users, errors] = partition(results) */ export declare function partition(values: V[]): [Exclude[], Extract[]]; /** * Flatten a nested errore: (E1 | (E2 | T)) becomes (E1 | E2 | T). * Useful when chaining operations that can fail. * * @example * const nested: NetworkError | (ParseError | User) = await fetchAndParse() * const flat: NetworkError | ParseError | User = flatten(nested) */ export declare function flatten(value: V): V; //# sourceMappingURL=extract.d.ts.map