When using generic pick, object deconstruction does not provide valid keys to select #45663
Labels
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Bug Report
🔎 Search Terms
Generic pick on object, type part of object, deconstructing of pick shows all keys of object
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
When using the deconstruction construction after pick, I can select b as well as a. But the a is not in object returned from pick.
When first assigning the return value to const, in later code I can only select b, which is expected.
🙂 Expected behavior
In deconstruction I should be able to select only keys, that I declared in pick function. The behaviour should be same as in second example, where the return object is first assigned to
obj
var and then refered.The text was updated successfully, but these errors were encountered: