Skip to content

ok

Returns an EitherRight<"ok", never>: an empty success that confirms an operation went fine without extra data.

TIP

ok is just a specialized alias of right("ok"). To better understand building Right values (mandatory info, unwrap, helpers), see the right page.

Interactive example

Syntax

typescript
function ok(): EitherOk

Parameters

None. The call simply signals that “all is well.”

Return value

A Right whose info is fixed to "ok" and whose wrapped value is never. Designed for commands or side effects that have nothing to return.

Use cases

  • Validate an imperative action (sending an email, mutation, scheduled job).
  • Harmonize returns when some paths have nothing to return but must stay compatible with the other Either values of your function.
  • Work with E.whenHasInformation(..., "ok", handler) to trigger a callback without payload.

See also

  • success – When you have a value to expose.
  • right – To choose custom information.
  • failLeft counterpart to signal failure without payload.

Released under the MIT license.