Conversation
|
Hmm, I'm not sure I follow the rationale here. Just because Can you provide a bit more context on what you're trying to accomplish and why? |
|
Is a correct summary that you intend for inference from |
|
At the end of the day, Consider this minimal definition for something promise-like: interface Promise<T> {
then(onfulfilled: (value: awaited T) => any): any
~~~~~
}The type of
In addition, It is possible this proposed heuristic may be too loose. In reality we may only want to perform this inference when the |
I believe that would be the case, yes. At least, in cases where the |
|
I did a little experiment where I changed inference between references to the same generic type to always proceed structurally if any type parameters have variances marked unreliable (as is the case with |
|
Do we want inference to proceed structurally for all "unreliable" variances or just cases where |
|
@rbuckton Just pushed the changes we talked about. We now perform structural type inference for any generic type with a type parameter that occurs in an Only change in baselines is that we flatten inferences from |
|
@typescript-bot perf test |
|
Heya @rbuckton, I've started to run the perf test suite on this PR at 70f92ff. You can monitor the build here. Update: The results are in! |
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
|
@rbuckton Here they are:Comparison Report - master..37540
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This seems to have improved things in vscode: https://github.com/typescript-bot/TypeScript/pull/9/files#diff-0e62d568d28b82cee9e66b2b8fafd290R7, however there seem to be a larger number of errors now in office-ui-fabric (https://github.com/typescript-bot/TypeScript/pull/9/files#diff-976ec9fe54f7b841cd49ec069e0303a9L135), though that may not be related to this change. |
|
Closing this in favor of #37610 for now while we continue to investigate the impact of |
This changes inference behavior when inferring a type argument that is
awaited:Fixes #37526