From ae27c872c039b5a8e1fa780d04b427a0a0cf25b3 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 13 Mar 2024 09:46:09 +0100 Subject: [PATCH] @uppy/utils: fix `AbortablePromise` type --- packages/@uppy/utils/src/RateLimitedQueue.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/@uppy/utils/src/RateLimitedQueue.ts b/packages/@uppy/utils/src/RateLimitedQueue.ts index 1c769e9a19..2948263c43 100644 --- a/packages/@uppy/utils/src/RateLimitedQueue.ts +++ b/packages/@uppy/utils/src/RateLimitedQueue.ts @@ -30,11 +30,15 @@ type QueueOptions = { priority?: number } -interface AbortablePromise extends Promise { +export interface AbortablePromise extends Promise { abort(cause?: unknown): void - abortOn: typeof abortOn + abortOn: (...args: Parameters) => AbortablePromise } +export type WrapPromiseFunctionType any> = ( + ...args: Parameters +) => AbortablePromise>> + export class RateLimitedQueue { #activeRequests = 0 @@ -223,7 +227,7 @@ export class RateLimitedQueue { outerPromise.abort = (cause) => { queuedRequest.abort(cause) } - outerPromise.abortOn = abortOn + outerPromise.abortOn = abortOn as any return outerPromise }