Skip to content

Improve inference for Promise.all of 'never[]' #39336

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

Closed
wants to merge 2 commits into from
Closed

Conversation

rbuckton
Copy link
Member

This adds overloads to Promise.all to improve treat a Promise.all for an array of type never[] as a Promise<never> rather than a Promise<never[]>.

Fixes #37856

@andrewbranch
Copy link
Member

Makes sense to me, but should we run user tests?

@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 30, 2020

Heya @andrewbranch, I've started to run the parallelized community code test suite on this PR at eb27d3e. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

@andrewbranch
Copy link
Member

@rbuckton
Copy link
Member Author

rbuckton commented Jul 1, 2020

Yeah, looking at this a little bit more, there really isn't a way to craft the overload list to get the correct result here.

@rbuckton rbuckton closed this Jul 1, 2020
@rbuckton
Copy link
Member Author

rbuckton commented Jul 1, 2020

Actually, I may have found a solution. I'll try that first before giving up on this line of thought...

@rbuckton rbuckton reopened this Jul 1, 2020
@rbuckton
Copy link
Member Author

rbuckton commented Jul 1, 2020

@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 1, 2020

Heya @rbuckton, I've started to run the parallelized community code test suite on this PR at b486b5e. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 1, 2020

Heya @rbuckton, I've started to run the extended test suite on this PR at b486b5e. You can monitor the build here.

@rbuckton
Copy link
Member Author

rbuckton commented Jul 2, 2020

Even this doesn't work because it collides with Promise.all<T> in vscode for cases like Promise.all<string[]>(...) when the intended return type is Promise<string[][]>.

For reference:
https://github.com/typescript-bot/TypeScript/pull/54/files#diff-0e62d568d28b82cee9e66b2b8fafd290R7

@rbuckton rbuckton marked this pull request as draft July 2, 2020 00:10
@rbuckton
Copy link
Member Author

rbuckton commented Jul 2, 2020

I'm switching this to a draft PR for the time being while I consider other alternatives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promise.all not removing never[] in catch narrowing
4 participants