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.

    Returns IWrappedFn<T, P>

    The wrapped function with cancellation capability.