Returns a new Ok result type with the provided value

  • Type Parameters

    • T

    Parameters

    • val: T

      Value of the result

    Returns Result<T, never>

    Ok(true);
    
    const functionThatCanFail = (condition) => {
    if (condition) {
    Ok("Success")
    }

    return Err("Failure");
    }