FuncType - v0.16.0
    Preparing search index...

    Interface Promisable<A>

    Promisable trait - supports conversion to Promise

    Represents containers or values that can be converted to Promise form. This enables integration with async/await patterns and Promise-based APIs while maintaining functional programming principles.

    const either: Either<string, number> = Right(42)
    const promise: Promise<number> = either.toPromise()
    // Promise resolves with 42

    const leftEither: Either<string, number> = Left("error")
    const failedPromise: Promise<number> = leftEither.toPromise()
    // Promise rejects with "error"
    interface Promisable<A extends Type> {
        toPromise(): Promise<A>;
    }

    Type Parameters

    • A extends Type

      The type of value contained within the Promise

    Hierarchy (View Summary)

    Index

    Methods

    Methods

    • Converts this container to a Promise

      The behavior depends on the implementing container:

      • Success/Right/Some containers resolve with their value
      • Failure/Left/None containers reject with their error/default error

      Returns Promise<A>

      A Promise that resolves or rejects based on the container's state