Skip to content

Commit

Permalink
mini type improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianMairinger committed Oct 19, 2024
1 parent cb43e33 commit 32c5eaa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/src/moreProms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ export type ResablePromise<T = unknown> = SettledPromProps<T> & ResablePromProps
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): ResablePromise<T | TResult>;
finally(onfinally?: (() => void) | undefined | null): ResablePromise<T>;
} & Promise<T>
export const CancelAblePromise = _CancelAblePromise as any as PromiseConstructor & { new<T = void, C = void, CT = C>(executor?: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, cancel?: (reason: C) => void): CancelAblePromise<T, C, CT> }

export type CancelFunc<C, CT> = (reason: C) => CT

export const CancelAblePromise = _CancelAblePromise as any as PromiseConstructor & { new<T = void, C = void, CT = C>(executor?: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => (CancelFunc<C, CT> | void), cancel?: (reason: C) => void): CancelAblePromise<T, C, CT> }
export type CancelAblePromise<T = unknown, C = void, CT = C> = SettledPromProps<T> & ResablePromProps<T> & CancelAblePromProps<T, C, CT> & {
then<TResult1 = T, TResult2 = never, newC extends C = C, newCT extends CT = CT>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null, onCancelForward?: true): CancelAblePromise<TResult1 | TResult2, newC, newCT>;
then<TResult1 = T, TResult2 = never, newC = void, newCT = newC>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null, onCancel?: (reason: newC) => newCT): CancelAblePromise<TResult1 | TResult2, newC, newCT>;
Expand Down

0 comments on commit 32c5eaa

Please sign in to comment.