result.ok

A successful result carrying a value and any warnings.

Value helperSince 0.3.0

Usage

TypeScript
Result.ok<T>(value: T, diagnostics?: readonly KernelDiagnostic[]): Result<T>

Parameters

  • valueT

    The value.

    Required

  • diagnosticsreadonly KernelDiagnostic[]

    Warnings or notes to carry with the success. Default [].

Returns

{ ok: true, value, diagnostics }. The value may itself be empty (an empty mesh); that is the operation’s documented success, not a failure.

Example

TypeScript
Result.ok(42) // → { ok: true, value: 42, diagnostics: [] }

See also