Repository navigation
Revert "Align object binding defaults with arrays" - #65556
Merged
Jake Bailey (jakebailey) merged 2 commits intoNov 18, 2026
Merged
Conversation
Padding a destructured parameter's default with its missing binding elements adds them as implicitly any, even when an annotation, a JSDoc @type signature, or a contextual type already types the parameter. That reports implicit any on elements that have types (64431, 64974, 65011), and under a contextual type a nested default's elements become any. Tuple defaults contextually typed by a tuple type have long reported the same errors.
This reverts commit 07d1338 (64043), keeping its tests. Padding every missing binding element of a destructured parameter's default made parameters with annotations or contextual types report implicit any for elements that have types, and made nested elements under a contextual type any. Restricting the padding to parameters typed by their initializer fixes those cases, but the remaining benefit, a better parameter type for unchecked JS (59920), is too small to keep carrying a change in this area. Fixes 64431 Fixes 64974
Jake Bailey (jakebailey)
requested review from
Ryan Cavanaugh (RyanCavanaugh) and
Wesley Wigham (weswigham)
and
a balanced review from Copilot
November 17, 2026 21:34
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the revert restoring prior object-binding default behavior.
No open issues 🎉
What changed in this PR
Reverts #64043’s object-binding default changes to address regressions #64431 and #64974 before TypeScript 7.1. This restores prior checker behavior while intentionally reopening #59920.
Changes:
- Limits object-literal padding to binding elements with defaults and disables implicit-any reporting during that padding.
- Preserves existing tests and adds contextual, annotated, nested, array, and JSDoc binding cases.
- Updates type, symbol, and diagnostic baselines to reflect the revert.
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/objectBindingPatternDefaultMissingElements.ts |
Adds regression cases for typed destructuring defaults. |
tsc/testdata/baselines/reference/compiler/objectBindingPatternDefaultMissingElements.types |
Records restored object signatures and new cases’ inferred types. |
tsc/testdata/baselines/reference/compiler/objectBindingPatternDefaultMissingElements.symbols |
Records symbol bindings for the added cases. |
tsc/testdata/baselines/reference/compiler/objectBindingPatternDefaultMissingElements.errors.txt |
Updates expected diagnostics, including unchanged tuple implicit-any errors. |
tsc/testdata/baselines/reference/compiler/inferredRestTypeFixedOnce.errors.txt |
Removes the implicit-any diagnostic baseline eliminated by the revert. |
tsc/internal/checker/checker.go |
Restores the previous object-literal padding behavior. |
Review effort: Balanced
Jake Bailey (jakebailey)
enabled auto-merge
November 17, 2026 21:52
Wesley Wigham (weswigham)
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #64431
Fixes #64974
Reopens #59920
Closes #64440
Closes #64671
Closes #64978
Closes #65070
Closes #65542
This reverts #64043, keeping its tests along with the cases from the issues above.
It's too close to 7.1 and I don't want to try and really fix this right now.