Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ResultShape<T, E>

Simply defines the common shape for Ok and Err.

Type parameters

  • T

  • E

Hierarchy

  • ResultShape

Implemented by

Index

Properties

variant

variant: Variant

Distinguish between the Ok and Err variants.

Methods

and

andThen

  • andThen<U>(this: Result<T, E>, andThenFn: function): Result<U, E>

ap

chain

  • chain<U>(this: Result<T, E>, chainFn: function): Result<U, E>

equals

  • equals(this: Result<T, E>, comparison: Result<T, E>): boolean

flatMap

  • flatMap<U>(this: Result<T, E>, chainFn: function): Result<U, E>

isErr

  • isErr(this: Result<T, E>): this is Err<T, E>

isOk

  • isOk(this: Result<T, E>): this is Ok<T, E>

map

  • Method variant for Result.map

    Type parameters

    • U

    Parameters

    • this: Result<T, E>
    • mapFn: function
        • (t: T): U
        • Parameters

          • t: T

          Returns U

    Returns Result<U, E>

mapErr

  • mapErr<F>(this: Result<T, E>, mapErrFn: function): Result<T, F>

mapOr

  • mapOr<U>(this: Result<T, E>, orU: U, mapFn: function): U
  • Method variant for Result.mapOr

    Type parameters

    • U

    Parameters

    • this: Result<T, E>
    • orU: U
    • mapFn: function
        • (t: T): U
        • Parameters

          • t: T

          Returns U

    Returns U

mapOrElse

  • mapOrElse<U>(this: Result<T, E>, orElseFn: function, mapFn: function): U
  • Method variant for Result.mapOrElse

    Type parameters

    • U

    Parameters

    • this: Result<T, E>
    • orElseFn: function
        • (err: E): U
        • Parameters

          • err: E

          Returns U

    • mapFn: function
        • (t: T): U
        • Parameters

          • t: T

          Returns U

    Returns U

match

or

orElse

  • orElse<F>(this: Result<T, E>, orElseFn: function): Result<T, F>

toJSON

toMaybe

toString

  • toString(this: Result<T, E>): string

unsafelyUnwrap

  • unsafelyUnwrap(): T | never

unsafelyUnwrapErr

  • unsafelyUnwrapErr(): E | never

unwrapOr

  • unwrapOr(this: Result<T, E>, defaultValue: T): T

unwrapOrElse

  • unwrapOrElse(this: Result<T, E>, elseFn: function): T

Generated using TypeDoc