Skip to content

Conversation

@gabritto
Copy link
Member

Fixes #47865.

When pushing down the instantiated contextual type from a parameter to its binding elements (i.e. a parameter that is a binding pattern), we relied on storing this parameter type in our type cache (symbolLinks.type), and retrieving this cached type when computing the type of its binding elements (in assignBindingElementTypes). However, if the binding element is a rest binding element, as of #47337 we skip looking for its parent type in the cache, because checkMode is going to have CheckMode.RestBindingElement set, and we compute the wrong (uninstantiated) type for the parent.
This fix makes it so we explicitly pass the parent type in assignBindingElementTypes, avoiding the need to rely on getting the cached type.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Feb 15, 2022
@RyanCavanaugh
Copy link
Member

@typescript-bot cherry-pick this to release-4.6

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 15, 2022

Heya @RyanCavanaugh, I've started to run the task to cherry-pick this into release-4.6 on this PR at b618cf9. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Hey @RyanCavanaugh, I've opened #47912 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Feb 15, 2022
Component commits: f4a5562 wip: possible fixes 75cb739 pass parameter type to assignBindingElementTypes 4a7de63 undo unnecessary changes b618cf9 update baselines
@gabritto gabritto merged commit 67f47bf into main Feb 15, 2022
@gabritto gabritto deleted the gabritto/issue47865 branch February 15, 2022 21:27
RyanCavanaugh pushed a commit that referenced this pull request Feb 16, 2022
Component commits: f4a5562 wip: possible fixes 75cb739 pass parameter type to assignBindingElementTypes 4a7de63 undo unnecessary changes b618cf9 update baselines Co-authored-by: Gabriela Araujo Britto <gabrielaa@microsoft.com>
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

5 participants