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