Skip to content

Conversation

@jakebailey
Copy link
Member

Found this while working on moving the target up to ES2024. This is illegal code, but we need to not attempt to transform it otherwise it'll break later.

CopilotAI review requested due to automatic review settings January 23, 2026 23:13
@github-project-automationgithub-project-automationbot moved this to Not started in PR BacklogJan 23, 2026
@typescript-bottypescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jan 23, 2026
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a crash in the TypeScript transformer when processing destructured parameter properties with ES2024 target. The code in question is illegal TypeScript (parameter properties cannot use binding patterns), but the compiler should not crash when processing it - it should emit the appropriate error and continue.

Changes:

  • Added a runtime check to skip parameter properties with non-identifier names (destructuring patterns) during class member transformation
  • Added a test case to ensure the fix works with ES2024 target

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
src/compiler/transformers/ts.tsAdded defensive check to skip destructured parameter properties before attempting to create property declarations
tests/cases/compiler/declarationEmitDestructuringParameterProperties2.tsTest case demonstrating the issue with ES2024 target
tests/baselines/reference/declarationEmitDestructuringParameterProperties2.typesBaseline showing type inference for the test case
tests/baselines/reference/declarationEmitDestructuringParameterProperties2.symbolsBaseline showing symbol resolution for the test case
tests/baselines/reference/declarationEmitDestructuringParameterProperties2.jsBaseline showing JS output with ES2024 target (modern class syntax)
tests/baselines/reference/declarationEmitDestructuringParameterProperties2.errors.txtBaseline showing expected TS1187 errors for illegal destructured parameter properties

@jakebaileyjakebailey changed the title Fix declaration emit crash with destructured parameter property Fix transform crash with destructured parameter property Jan 23, 2026
@github-project-automationgithub-project-automationbot moved this from Not started to Needs merge in PR BacklogJan 23, 2026
@jakebaileyjakebailey added this pull request to the merge queueJan 23, 2026
Merged via the queue into microsoft:main with commit b19a9daJan 23, 2026
38 of 39 checks passed
@jakebaileyjakebailey deleted the fix-decl-crash branch January 23, 2026 23:58
@github-project-automationgithub-project-automationbot moved this from Needs merge to Done in PR BacklogJan 23, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: TeamFor Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants

@jakebailey@DanielRosenwasser@typescript-bot