GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Revert binding pattern inference changes, but only for tuples by andrewbranch · Pull Request #46009 · microsoft/TypeScript

Conversation

@andrewbranch

@andrewbranch Andrew Branch (andrewbranch) commented Sep 22, 2021

Copy link
Copy Markdown
Member

Partial revert of #45719—we now let an array binding pattern turn inference of an array into a tuple, which is really nice. I still think the behavior we were seeing for object binding patterns was undesirable, and #45846 supports that hypothesis since all the related errors were due to a tuple turning into an array.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@andrewbranch
Revert binding pattern inference changes, but only for tuples
c3bcc4c
@typescript-bot TypeScript Bot (typescript-bot) assigned Andrew Branch (andrewbranch) Sep 22, 2021
@typescript-bot TypeScript Bot (typescript-bot) added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 22, 2021
@andrewbranch
Andrew Branch (andrewbranch) requested a review from Anders Hejlsberg (ahejlsberg) September 22, 2021 19:03
@andrewbranch

Andrew Branch (andrewbranch) commented Sep 22, 2021

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) user test this inline

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Sep 22, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Heya Andrew Branch (@andrewbranch), I've started to run the inline community code test suite on this PR at c3bcc4c. You can monitor the build here.

Update: The results are in!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Sep 22, 2021

Copy link
Copy Markdown
Contributor

Andrew Branch (@andrewbranch)
Great news! no new errors were found between main..refs/pull/46009/merge

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rbuckton
Ron Buckton (rbuckton) approved these changes Sep 22, 2021
View reviewed changes
@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) mentioned this pull request Sep 22, 2021
Design Meeting Notes, 9/22/2021 #46012
Closed
@andrewbranch

Andrew Branch (andrewbranch) commented Sep 22, 2021

Copy link
Copy Markdown
Member Author

We realized that

declare function f<T>(): T;
const [a, b, c] = f();

should really error, and this PR makes it legal (T is inferred as [any, any, any]). While it may be true that object binding patterns never contribute anything useful to type argument inference, it is not true that array binding patterns always contribute usefully to type argument inference. What we really want is for binding patterns to contribute contextual typing information to other inference sources, while never being allowed to stand on their own as inference sources. I’m going to close this and do a full revert of #45719 so we can investigate a more thorough solution in the future.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andrewbranch Andrew Branch (andrewbranch) closed this Sep 22, 2021
@andrewbranch
Andrew Branch (andrewbranch) deleted the bug/array-binding-pattern branch September 22, 2021 23:07
@andrewbranch Andrew Branch (andrewbranch) mentioned this pull request Sep 22, 2021
When using generic pick, object deconstruction does not provide valid keys to select #45663
Closed
@andrewbranch Andrew Branch (andrewbranch) mentioned this pull request May 12, 2022
Limit type argument inference from binding patterns #49086
Merged
@Andarist Mateusz Burzyński (Andarist) mentioned this pull request Dec 25, 2023
Fixed inferred type widening with contextual types created by binding patterns #56875
Closed
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@ahejlsberg Anders Hejlsberg (ahejlsberg) Awaiting requested review from ahejlsberg
1 more reviewer
@rbuckton Ron Buckton (rbuckton) rbuckton approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@andrewbranch Andrew Branch (andrewbranch)

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@andrewbranch @typescript-bot @rbuckton
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.