Created
June 9, 2020 17:28
-
-
Save g4rcez/47d3ec51cd2e3f6f7f72059bb76c1053 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface PromiseLike<T> { | |
then<R1 = T, R2 = never>( | |
resolve?: ((value: T) => R1 | PromiseLike<R1>) | undefined | null, | |
reject?: ((reason: any) => R2 | PromiseLike<R2>) | undefined | null | |
): PromiseLike<R1 | R2>; | |
} | |
type ReadonlyPromise<T> = PromiseLike<Readonly<T>> | Readonly<T>; | |
const PromiseAll = async <T>(...values: ReadonlyPromise<T>[]): Promise<T> => { | |
const promises = await Promise.all(values[0] as any); | |
return promises as any; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fix in promise array