Type Alias Result<T, E>

Result<T, E>: Ok<T> | Err<E>

Result is a type that represents a result of an operation that may or may not be successful.

Type Parameters

  • T = unknown

    The type of the value.

  • E = Error

    The type of the error.

const result: Result<number, string> = new Ok(42);
const result2: Result<number, string> = new Err('Error');