Skip to content

fix(isolated-declarations): strip default values from rest parameter binding patterns#17602

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/01-03-fix_isolated-declarations_strip_default_values_from_rest_parameter_binding_patterns
Jan 3, 2026
Merged

fix(isolated-declarations): strip default values from rest parameter binding patterns#17602
graphite-app[bot] merged 1 commit intomainfrom
c/01-03-fix_isolated-declarations_strip_default_values_from_rest_parameter_binding_patterns

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Jan 3, 2026

Closes #17598

@github-actions github-actions bot added A-isolated-declarations Isolated Declarations C-bug Category - Bug labels Jan 3, 2026
Copy link
Contributor Author

camc314 commented Jan 3, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 3, 2026

CodSpeed Performance Report

Merging #17602 will not alter performance

Comparing c/01-03-fix_isolated-declarations_strip_default_values_from_rest_parameter_binding_patterns (fed9dbb) with main (6154c8c)1

Summary

✅ 38 untouched
⏩ 7 skipped2

Footnotes

  1. No successful run was found on main (605dbf1) during the generation of this report, so 6154c8c was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camc314 camc314 marked this pull request as ready for review January 3, 2026 11:38
Copilot AI review requested due to automatic review settings January 3, 2026 11:38
@camc314 camc314 requested a review from Dunqing as a code owner January 3, 2026 11:38
Copy link
Contributor

Copilot AI 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 bug in the isolated declarations feature where default values in rest parameter binding patterns were incorrectly preserved in generated .d.ts files, causing TypeScript compiler errors. The fix ensures that default values are stripped from rest parameter patterns, consistent with how they are already handled for regular parameters.

Key Changes

  • Modified transform_formal_parameters to recursively remove assignment patterns (default values) from rest parameter binding patterns
  • Added test cases covering rest parameters with default values in both simple and nested destructuring patterns

Reviewed changes

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

File Description
crates/oxc_isolated_declarations/src/function.rs Added logic to strip default values from rest parameter binding patterns using the existing remove_assignments_from_kind visitor
crates/oxc_isolated_declarations/tests/fixtures/function-parameters.ts Added two test cases for rest parameters with default values: simple destructuring and nested destructuring
crates/oxc_isolated_declarations/tests/snapshots/function-parameters.snap Updated snapshot showing correctly stripped default values in generated declarations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Dunqing
Copy link
Member

Dunqing commented Jan 3, 2026

Is this a regression caused by #15925?

@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Jan 3, 2026
Copy link
Member

Dunqing commented Jan 3, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the c/01-03-fix_isolated-declarations_strip_default_values_from_rest_parameter_binding_patterns branch from fed9dbb to ab5e4ca Compare January 3, 2026 15:28
@graphite-app graphite-app bot merged commit ab5e4ca into main Jan 3, 2026
20 checks passed
@graphite-app graphite-app bot deleted the c/01-03-fix_isolated-declarations_strip_default_values_from_rest_parameter_binding_patterns branch January 3, 2026 15:34
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 3, 2026
@camc314
Copy link
Contributor Author

camc314 commented Jan 3, 2026

Is this a regression caused by #15925?

yes

graphite-app bot pushed a commit that referenced this pull request Jan 5, 2026
### 🚀 Features

- 659c23e linter: Init note field boilerplate  (#17589) (Shrey Sudhir)
- 6870b64 parser: Add TS1363 error code (#17609) (Sysix)
- 23680a3 mangler: Skip mangling only in scopes affected by direct eval (#17612) (camc314)
- a7e1643 parser: Add TS2528 error code to duplicate_default_export diagnostic (#17558) (camc314)

### 🐛 Bug Fixes

- 1044116 ecmascript: Mark `new Symbol` as non side-effect free (#17568) (camc314)
- ab5e4ca isolated-declarations: Strip default values from rest parameter binding patterns (#17602) (camc314)
- 68b2e54 minifier: Prevent incorrect ??= transformation when member base is mutated (#17472) (copilot-swe-agent)

### ⚡ Performance

- 6067143 semantic: Remove hash when checking identifier (#17564) (camchenry)
- a28ab3d semantic: Avoid bounds check when checking string literal (#17545) (camc314)
- 04809d1 semantic: Use SIMD for finding backslashes in `check_string_literal` (#17534) (camchenry)
- 49ad2f0 semantic: Mark all diagnostic functions as `#[cold]` (#17487) (camc314)
- ea82b50 transformer: Mark all diagnostic functions as `#[cold]` (#17486) (camc314)
- d968e51 semantic: Mark `checker::check` as `inline(always)` (#17459) (camc314)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-isolated-declarations Isolated Declarations C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(oxc-transform): Isolated Declarations Incorrectly Preserves Default Values in Rest Parameters

3 participants