Uh oh!
There was an error while loading. Please reload this page.
Allow identical type parameter lists to merge in union signatures - #31023
Conversation
…rameters, allow identical type parameter lists to merge in union signatures
Nathan Shively-Sanders (sandersn)
commented
Mar 3, 2020
The linked issue is now fixed, so I'm closing this. Wesley Wigham (@weswigham) feel free to re-open if that's not correct. |
Wesley Wigham (weswigham)
commented
Mar 4, 2020
Mmm this was still open because it also happens to fix another suite of issues to do will calling unions of signatures with type parameters; it does need a bit of a refresh, though. |
Wesley Wigham (weswigham)
commented
Mar 4, 2020
Nathan Shively-Sanders (@sandersn) I've refreshed this PR, renamed it, and redone the OP with links to relevant issues. |
Wesley Wigham (weswigham)
commented
Mar 4, 2020
TypeScript Bot (@typescript-bot) run dt |
Heya Wesley Wigham (@weswigham), I've started to run the parallelized Definitely Typed test suite on this PR at e14c58e. You can monitor the build here. |
Heya Wesley Wigham (@weswigham), I've started to run the extended test suite on this PR at e14c58e. You can monitor the build here. |
Heya Wesley Wigham (@weswigham), I've started to run the perf test suite on this PR at e14c58e. You can monitor the build here. Update: The results are in! |
Heya Wesley Wigham (@weswigham), I've started to run the parallelized community code test suite on this PR at e14c58e. You can monitor the build here. |
TypeScript Bot (typescript-bot)
commented
Mar 4, 2020
Wesley Wigham (@weswigham) Here they are:Comparison Report - master..31023
System
Hosts
Scenarios
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TypeScript Bot (typescript-bot)
commented
Mar 4, 2020
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
Wesley Wigham (weswigham)
commented
Mar 4, 2020
Perf looks good, user and DT tests look fine, and RWC baseline diff is the removal of a few errors on calls we can now actually resolve (all of them |
Nate Abele (nateabele)
commented
May 21, 2020
Glad to see movement on this. I keep running into it when I try to do basically any non-trivial data modeling. |
Jake Teton-Landis (justjake)
commented
Jul 19, 2020
Is this going to make it into TS 4.0? |
| } | ||
| function combineUnionParameters(left: Signature, right: Signature) { | ||
| function combineUnionParameters(left: Signature, right: Signature, mapper: TypeMapper | undefined) { |
There was a problem hiding this comment.
Interesting, it took me a second to grok what this was for. Would it have worked to just instantiateSignature(right, mapper) and pass that in instead of instantiating each parameter type on demand?
Andrew Branch (andrewbranch)
commented
Sep 22, 2020
TypeScript Bot (@typescript-bot) pack this |
Heya Andrew Branch (@andrewbranch), I've started to run the tarball bundle task on this PR at e14c58e. You can monitor the build here. |
Wesley Wigham (weswigham)
commented
Dec 15, 2020
TypeScript Bot (@typescript-bot) run dt |
Heya Wesley Wigham (@weswigham), I've started to run the parallelized community code test suite on this PR at 3037443. You can monitor the build here. |
Heya Wesley Wigham (@weswigham), I've started to run the parallelized Definitely Typed test suite on this PR at 3037443. You can monitor the build here. |
Heya Wesley Wigham (@weswigham), I've started to run the extended test suite on this PR at 3037443. You can monitor the build here. |
Heya Wesley Wigham (@weswigham), I've started to run the perf test suite on this PR at 3037443. You can monitor the build here. Update: The results are in! |
TypeScript Bot (typescript-bot)
commented
Dec 16, 2020
Wesley Wigham (@weswigham) Here they are:Comparison Report - master..31023
System
Hosts
Scenarios
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TypeScript Bot (typescript-bot)
commented
Dec 16, 2020
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
Wesley Wigham (weswigham)
commented
Dec 16, 2020
All baselines still look good, excellent. |
Andrew Branch (andrewbranch)
commented
Dec 16, 2020
Happy to see this merged! 🥳 |
Finishes fixing #30717
Fixes#36307
Fixes#36390 mostly (for all but the
reducecase, since that has overloads)In the first linked issue, the call
tmp.get('t')was allowed because the two differing signatures were seen as "identical" bycompareSignaturesIdentical, since it erased the type parameters toany(causing their different return types to both look likeany). We have since fixed that, however the call was still flagged as an error, but it'd be nice for it to succeed since, ultimately, only the return types differ. So I now allow unions of signatures to merge when their type parameter lists are identical - when this is the case, all following union signature element parameter/return types are instantiated with a mapping of their type parameters into the type parameters from the first type parameter list found. Type parameter defaults are not considered in this mapping (otherwise.thenon promise really doesn't work).