Function lift

  • Lift from function returning value/promise to function returning task resolving to that value

    Userfull for converting exising async functions to task functions for further use

    Type Parameters

    • A extends unknown[]

      returned function's argument types

    • R

      returned function's result task's resolve type

    Parameters

    • promiseFunction: ((...args) => PromiseLike<R>)

      function returning promise or plain value to be resolved

        • (...args): PromiseLike<R>
        • Parameters

          • Rest ...args: A

          Returns PromiseLike<R>

    Returns TaskFunction<A, R>

    task function wrapping specified promise function

    See

    Task.fromPromise

    Example

    const taskFunction = liftPromiseFunction(someAsyncOperation);

    const task = taskFunction('someData').map((result) => result.length);

Generated using TypeDoc