Function cancelable

Wraps a promise function and provides cancellation functionality.

  • Type Parameters

    • T extends unknown = any

      The type of the promise's resolved value.

    • P extends any[] = any[]

      The type of the promise function's arguments.

    Parameters

    • promise: ((...args: P) => Promise<T>)

      The promise function to wrap.

        • (...args): Promise<T>
        • Parameters

          • Rest...args: P

          Returns Promise<T>

    Returns IWrappedFn<T, P>

    The wrapped function with cancellation capability.