-
-
Notifications
You must be signed in to change notification settings - Fork 11
Variadic types #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sure |
While doing it I actually faced a bug also present in I'll see if the fix in the PR (https://github.com/microsoft/TypeScript/pull/33707/files) is also working for pSettle, if yes, I'll do the PR. |
It is working 🎉 type Awaited<T> = T extends undefined ? T : T extends PromiseLike<infer U> ? U : T
export function pSettle<T extends readonly any[]>(
values: T,
options?: pSettle.Options
): Promise<{ -readonly [P in keyof T]: PromiseResult<Awaited<T[P]>> }> // However, as the PR on TS is not fixed I don't know if this could lead to unexpected issues. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Today, the TS definition does not support having different type for each promise passed.
This is a known limitation in Typescript and there is a funny workaround that can be seen in the definition for
Promise.all()
: https://github.com/microsoft/TypeScript/blob/master/lib/lib.es2015.promise.d.ts#L113Would you accept a PR that would apply the same pattern in the
d.ts
file?The text was updated successfully, but these errors were encountered: