Skip to content

Ghost errors and inconsistencies in destructuring patternsΒ #59177

Closed
@ahejlsberg

Description

@ahejlsberg

πŸ”Ž 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

function foo() { return a }

const [a, b = a + 1] = [42];  // Error disappears when foo is commented out

const [x1, y1 = x1] = [123];  // No error
const [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

Assignees

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