Function ok

  • Create a successful result with some data.

    Example

    import { ok, isOk, isErr } from "typerun/result";

    const result = ok(42);
    console.log(isOk(result)); // true
    console.log(isErr(result)); // false
    console.log(result.data); // 42

    Type Parameters

    • R

    Parameters

    • data: R

      The data to wrap in a successful result.

    Returns Ok<R>