Function: succeed()

Creates a Success result from a given value. Automatically wraps the value in a Promise if it is asynchronous.

Type Param

The type of the value to wrap.

Examples

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

const result = Result.succeed(42);
// Result.Result<number, never>
import { Result } from '@praha/byethrow';

const result = Result.succeed(Promise.resolve(42));
// Result.ResultAsync<number, never>
import { Result } from '@praha/byethrow';

const result = Result.succeed();
// Result.Result<void, never>

See

combine - For combining multiple Results into a single Result.

Call Signature

succeed(): Result<void, never>

Defined in: functions/succeed.ts:44

Returns

Result<void, never>

Call Signature

succeed<T>(value): ResultFor<T, Awaited<T>, never>

Defined in: functions/succeed.ts:45

Type Parameters

T

T

Parameters

value

T

Returns

ResultFor<T, Awaited<T>, never>