Result<T, E>

Anatomy

type ResultVariants<T, E> = {
  Ok: T;
  Err: E;
};

Import

import { Result, Ok, Err } from "tnum/std";

Usage

import { Result, Ok, Err } from "tnum/std";

// Ok
const ok: Result<number, string> = Ok(1024);
// Err
const err: Result<number, string> = Err("error");

// unwrap
ok.unwrap(); // returns 1024.
err.unwrap(); // throws error.

Methods

TODO