Function isOk

  • Check if a result is successful.

    Example

    import { isOk } from "typerun/result";
    import { string } from "typerun/schema";
    import { validate } from "typerun";

    const result = validate(string)("hello");

    if (isOk(result)) {
    console.log(result.data); // "hello"
    } else {
    console.log(result.errors);
    }

    Type Parameters

    • R

    Parameters

    Returns result is Ok<R>