API Reference / @evolu/common / Result / ok

Function: ok()

Defined in: packages/common/src/Result.ts:319

Creates an Ok result.

  • ok() creates an Ok<void> for operations that succeed without producing a value.
  • ok(value) creates an Ok<T> containing the specified value.

Example

const noValue = ok();
console.log(noValue); // { ok: true, value: undefined }

const success = ok(42);
console.log(success); // { ok: true, value: 42 }

Returns

Ok<void>

Defined in: packages/common/src/Result.ts:321

Creates an Ok result with a specified value.

Type Parameters

Type Parameter
T

Parameters

ParameterType
valueT

Returns

Ok<T>

Was this page helpful?