Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDon't inferFromIndexTypes() twice #34501
Conversation
|
@typescript-bot user test this |
|
@typescript-bot user test this |
|
Heya @RyanCavanaugh, I've started to run the parallelized community code test suite on this PR at e427f3f. You can monitor the build here. It should now contribute to this PR's status checks. |
|
Heya @RyanCavanaugh, I've started to run the extended test suite on this PR at e427f3f. You can monitor the build here. It should now contribute to this PR's status checks. |
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
dea9d72
to
d045c4c
d37394a
to
82d6ad7
4765642
to
8af1dca
|
@jablko rather than the other changes in if (isArrayType(target)) {
inferFromIndexTypes(source, target);
return;
}from |
|
@weswigham Thanks a lot for taking a look at this! What you describe would call
|
1a56348
to
84baa5c
Hm, if that's the case, can we copy the tuple check into the |
|
|
09e96b8
to
6be718c
9c6fe7d
to
2cfb902
c248e7f
to
f85c83f
012cbda
to
3f15d40
|
@weswigham are you happy with this change now? It's been a while, but the inference code hasn't changed much in the last few months. |
|
Yeah, I think this is fine now (it just moves a chunk of code out of a call and into the (only) caller), I just wanted @ahejlsberg to look at it briefly before it got in, which is why he's assigned iirc. |


jablko commentedOct 15, 2019
•
edited
Fixes #33559
Fixes #33752
Fixes
#34924Fixes #34925
Fixes #34937
Fixes
#35136Fixes
#35258Currently
f2(values)isnumberwhilef1(values)is1.There are three cases in
inferFromProperties()inferFromIndexTypes()But then
inferFromObjectTypesWorker()callsinferFromIndexTypes()again, in all casesThis PR moves that call from
inferFromObjectTypesWorker()to the third case. ConsequentlyinferFromIndexTypes()isn't called twice in the second (array) casef2(values)is1likef1(values)FYI
f1(values)is currently1unlikef2(values)because parameter and argument are the same generic type (tuple) and handled bywhereas
f2(values)parameter (readonly tuple) and argument (tuple) aren't.