Skip to content

Ghost errors and inconsistencies in destructuring patterns #59177

Description

🔎 Search Terms

Destructuring

🕗 Version & Regression Information

This changed in #56753

⏯ Playground Link

https://www.typescriptlang.org/play/?ssl=7&ssc=1&pln=1&pc=1#code/GYVwdgxgLglg9mABMOcAUBKRBvRAnAUyhDyQENEBfAKGogQGcpEBtMgGkQCNEBeRCgGpEARgC6fVgBYATGIDciRAHpliAKJ48cPIgAmMBmQAOxgmTwNEAdwAWBJCjiJDiegFt3DqAT2I4IFC09GBMrAAeIpwAniKSkRL8LCIyAMwKSqqIAHLOBFo6dIzMLOEyMTLx5YgAXpX80XKSyWkZKmoAqmAE4WbQvoj52rr2hNRAA

💻 Code

functionfoo(){returna}const[a,b=a+1]=[42];// Error disappears when foo is commented outconst[x1,y1=x1]=[123];// No errorconst[x2,y2=x2,z2=y2]=[123];// Unexpected error here

🙁 Actual behavior

Unexpected errors.

🙂 Expected behavior

No errors.

Additional information about the issue

No response

Metadata

Metadata

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions