Переглянути джерело

@uppy/aws-s3: fix JSDoc type error (#3785)

Antoine du Hamel 2 роки тому
батько
коміт
bad2fa7ca2

+ 1 - 1
packages/@uppy/aws-s3/src/index.js

@@ -151,7 +151,7 @@ export default class AwsS3 extends BasePlugin {
      * keep track of `getUploadParameters()` responses
      * so we can cancel the calls individually using just a file ID
      *
-     * @type {object.<string, Promise>}
+     * @type {Record<string, import('@uppy/utils/lib/RateLimitedQueue').AbortablePromise<unknown>>}
      */
     const paramsPromises = Object.create(null)
 

+ 5 - 3
packages/@uppy/utils/types/index.d.ts

@@ -53,7 +53,9 @@ declare module '@uppy/utils/lib/ProgressTimeout' {
 declare module '@uppy/utils/lib/RateLimitedQueue' {
   namespace RateLimitedQueue {
     export type AbortFunction = () => void
-    export type PromiseFunction = (...args: any[]) => Promise<any>
+    export interface AbortablePromise<T> extends Promise<T> {
+      abort(): void
+    }
     export type QueueEntry = {
       abort: () => void,
       done: () => void,
@@ -72,9 +74,9 @@ declare module '@uppy/utils/lib/RateLimitedQueue' {
     ): RateLimitedQueue.QueueEntry
 
     wrapPromiseFunction(
-      fn: () => RateLimitedQueue.PromiseFunction,
+      fn: () => (...args: any[]) => Promise<any>,
       queueOptions?: RateLimitedQueue.QueueOptions
-    ): RateLimitedQueue.PromiseFunction
+    ): (...args: any[]) => RateLimitedQueue.AbortablePromise<any>
   }
 
   export const internalRateLimitedQueue: symbol