Class Ok<T, ErrObj>

Represents a successful result containing a value. This class indicates that an operation completed successfully.

Type Parameters

  • T

    The type of the success value

  • ErrObj

    The type of the error object (for type compatibility)

Hierarchy

Implements

Constructors

Properties

val?: T | RnError<ErrObj>

The value to store (either success value or error)

Methods

  • Pattern matching implementation for Result types.

    Type Parameters

    • R

      The type of the return value from the Ok function

    • ErrObj2

      The type of the new error object

    Parameters

    Returns Result<R, ErrObj2>

    A new Result containing the result of the pattern matching

    If the result is neither Ok nor Err

  • Gets the name of this result class.

    Returns string

    The constructor name ('Ok' or 'Err')

  • Safely returns the contained value.

    Returns T

    The contained success value

  • Returns the contained value since this is a successful result. The compensation function is not called.

    Parameters

    Returns T

    The contained success value