API reference@evolu/commonResult › ok

Call Signature

function ok(): Result<void>;

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

Creates an Ok result.

  • ok() creates a Result<void, never> for operations that succeed without producing a value.
  • ok(value) creates a Result<T, never> 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 }

Call Signature

function ok<T>(value: T): Result<T>;

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

Creates an Ok result with a specified value.