Type Alias: InferErr<T>
InferErr<
T
> =ExtractErr
<Awaited
<Returned
<T
>>>
Defined in: index.ts:144
Extracts Err types from a type, handling promises and function return types. This utility unwraps promises and function return types before extracting Err types.
Type Parameters
T
T
The type to extract Err types from (can be a function or promise)
Example
typescript
type T1 = InferErr<Result<string, Error>>; // Err<Error>
type T2 = InferErr<Promise<Result<string, Error>>>; // Err<Error>
type T3 = InferErr<() => Result<number, string>>; // Err<string>
type T4 = InferErr<() => Promise<Result<User, ApiError>>>; // Err<ApiError>