Type Alias: ResultMaybeAsync<T, E>

ResultMaybeAsync<T, E> = Result<T, E> | Promise<Result<T, E>>

Defined in: result.ts:116

A result that may be either synchronous or asynchronous.

Type Parameters

T

T

The type of the Success value.

E

E

The type of the Failure value.

Examples

import { Result } from '@praha/byethrow';

const result: Result.ResultMaybeAsync<number, string> = { type: 'Success', value: 10 };
import { Result } from '@praha/byethrow';

const result: Result.ResultMaybeAsync<number, string> = Promise.resolve({ type: 'Failure', error: 'error' });