Quickinfo for contextually typed arrow function parameter can be incorrect #21382
Labels
Bug
A bug in TypeScript
Domain: Quick Info
e.g. hover text, tool-tips, and tooltips.
Fixed
A PR has been merged for this issue
Milestone
TypeScript Version: 2.7.0-dev.201xxxxx
Search Terms:
Code
Expected behavior:
Hover over
val
- seenumber
. (Also: typeval.
in the lambda body and trigger completions, get completions for numbers). Hover overnextValues
, see(val: number) => number
.Actual behavior:
val
's quick info isany
(compilation and errors show it is assigned the correct type during compilation, the quick info onGenericComponent
is thankfully correct), has no completions (beingany
), andnextValues
has a quickinfo type of(cur: number) => number & (val: number) => number
, which is an intersection of two conspicuously identical signatures.Playground Link (Also, here's a fourslash test to start anyone working on this off)
Preliminary investigation (read: believing this bug was related to JSX before trying the same construct outside a JSX tag) led me to believe this has something to do with execution order, as inference statefully assigns types to symbols via
assignTypeToParameterAndFixTypeParameters
, meaning if inference happens it assigns a type to the symbol, whereas if that hasn't happened and there's no cached type from an inference triggered by acheck
call, quickinfo only finds the contextual type for the position. However requesting errors (which does a full typecheck) prior to checking quickinfo doesn't hide the error (which would be expected if the issue depended on execution order), so I'm unsure what the underlying problem is. The correct types are returned at these positions for our.types
baselines bygetTypeAtLocation
, which, in these cases, is just a roundabout way to saygetTypeOfSymbol
on the node's symbol, which is the same asgetTypeOfSymbolAtLocation
in these locations (which is what's used in services).The text was updated successfully, but these errors were encountered: