Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash from inaccurate type guard implementation #49252

Merged

Conversation

andrewbranch
Copy link
Member

Fixes 🙃 #49003 (comment)

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels May 25, 2022
Comment on lines -2200 to -2202
if (node.kind === SyntaxKind.BindingElement) {
node = node.parent.parent;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the problem code; other changes are accounting for the deletion. The issue is that this function gets consumed exclusively by functions whose return type is a predicate of node being some sort of VariableDeclaration, so this defeats that type predicate.

@andrewbranch andrewbranch added this to the TypeScript 4.7.3 milestone May 25, 2022
@RyanCavanaugh
Copy link
Member

TypeScript crashes     Mama Mia

                  🤝

          uncertain parenthood

@andrewbranch
Copy link
Member Author

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 26, 2022

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

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request May 26, 2022
Component commits:
94cf127 Fix `isVariableDeclarationInitializedToBareOrAccessedRequire` returning true on binding elements

fae1bbe Undo auto format change
@typescript-bot
Copy link
Collaborator

Hey @andrewbranch, I've opened #49272 for you.

@andrewbranch andrewbranch merged commit 5b86612 into microsoft:main May 26, 2022
@andrewbranch andrewbranch deleted the bug/49003/require-destructuring branch May 26, 2022 23:43
andrewbranch added a commit that referenced this pull request May 26, 2022
Component commits:
94cf127 Fix `isVariableDeclarationInitializedToBareOrAccessedRequire` returning true on binding elements

fae1bbe Undo auto format change

Co-authored-by: Andrew Branch <andrew@wheream.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants