• English
  • Type Alias: Failure<E>

    Failure<E> = object

    Represents a failed result.

    Example

    import { 
    import Result
    Result
    } from '@praha/byethrow';
    const
    const failure: Result.Failure<string>
    failure
    :
    import Result
    Result
    .
    type Failure<E> = {
        readonly type: "Failure";
        readonly error: E;
    }

    Represents a failed result.

    @typeParamE - The type of the error.@example
    import { Result } from '@praha/byethrow';
    
    const failure: Result.Failure<string> = {
      type: 'Failure',
      error: 'Something went wrong',
    };
    @categoryCore Types
    Failure
    <string> = {
    type: "Failure"
    type
    : 'Failure',
    error: string
    error
    : 'Something went wrong',
    };

    Type Parameters

    E

    E

    The type of the error.

    Properties

    error

    readonly error: E


    type

    readonly type: "Failure"