-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Typescript can't infer types when using Proxy #20846
Copy link
Copy link
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do thisYou can do this
Milestone
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do thisYou can do this
Code
Expected behavior:
I would expect that when I type
prox.prop1., I would get typescript suggestions forNumber.prototype, but instead, I get suggestions forFunction.prototype.prox.prop1will (according to typescript) still be callable as a function, but in runtime, it will clearly be a number and will throw an exception.Statically evaluate the proxy traps and determine the type of thing being returned to offer proper typescript intellisense.