Infers the Success value type T from a Result or a function returning a Result.
T
A ResultMaybeAsync type or a function returning it.
import { Result } from '@praha/byethrow';type R = Result.Result<number, string>;type SuccessValue = Result.InferSuccess<R>; // number Copy
import { Result } from '@praha/byethrow';type R = Result.Result<number, string>;type SuccessValue = Result.InferSuccess<R>; // number
import { Result } from '@praha/byethrow';const fn = () => Promise.resolve({ type: 'Success', value: 123 } as const);type SuccessValue = Result.InferSuccess<typeof fn>; // number Copy
import { Result } from '@praha/byethrow';const fn = () => Promise.resolve({ type: 'Success', value: 123 } as const);type SuccessValue = Result.InferSuccess<typeof fn>; // number
Infers the Success value type
T
from a Result or a function returning a Result.