A union type representing either a success or a failure.
The type of the Success value.
The type of the Failure value.
import { Result } from '@praha/byethrow';const doSomething = (): Result.Result<number, string> => { return Math.random() > 0.5 ? { type: 'Success', value: 10 } : { type: 'Failure', error: 'Oops' };}; Copy
import { Result } from '@praha/byethrow';const doSomething = (): Result.Result<number, string> => { return Math.random() > 0.5 ? { type: 'Success', value: 10 } : { type: 'Failure', error: 'Oops' };};
A union type representing either a success or a failure.