ts-railway
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.4 • Public • Published

    ts-railway

    npm version CircleCI codecov Type Coverage Dependency Status devDependencies Status npm

    ROP flavoured Result & AsyncResult types

    Getting started

    $ npm install ts-railway --save

    Overview

    Result

    export declare type Result<Success, Failure> =
      | {
          readonly tag: 'success'
          readonly success: Success
        }
      | {
          readonly tag: 'failure'
          readonly failure: Failure
        }
    
    //...
    
    export declare const Result: {
      readonly success: typeof createSuccess
      readonly failure: typeof createFailure
      readonly map: typeof map
      readonly flatMap: typeof flatMap
      readonly mapError: typeof mapError
      readonly flatMapError: typeof flatMapError
      readonly unwrap: typeof unwrap
      readonly combine: typeof combine
    }

    AsyncResult

    export type AsyncResult<Success, Failure> = Promise<Result<Success, Failure>>
    
    //...
    
    export declare const AsyncResult: {
      readonly map: typeof map
      readonly mapAsync: typeof mapAsync
      readonly flatMap: typeof flatMap
      readonly mapError: typeof mapError
      readonly mapErrorAsync: typeof mapErrorAsync
      readonly flatMapError: typeof flatMapError
      readonly unwrap: typeof unwrap
      readonly combine: typeof combine
    }

    Credits

    Install

    npm i ts-railway

    DownloadsWeekly Downloads

    29

    Version

    2.0.4

    License

    MIT

    Unpacked Size

    132 kB

    Total Files

    29

    Last publish

    Collaborators

    • avatar