Introduce 'getTypeOfExpression' function #12396
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new
getTypeOfExpression
function in the checker. UnlikecheckExpression
, this function is simply concerned with computing the type and may not fully check all contained sub-expressions for errors. IngetTypeOfExpression
we optimize for the common case of a call to a function with a single non-generic call signature where we can just fetch the return type without checking the arguments. Ideally, over time the entire family ofcheckXXX
functions whould have a parameter that indicates whether full error checking is required such that we can perform more optimizations locally.Fixes #12319. Actually, #12319 was sort of fixed by #12362, but only when
--noImplicitAny
is not specified. For that reason we have the flag on in the regression test.