Fixed a false positive related to binding patterns and spread expressions (#49684)

* Fixed a false positive related to binding patterns and spread expressions

* Improve ancestor lookup when checking if an expression is spread into an object

* Fixed ancestor lookup for more node types

* Remove equality check for contextual types

* Reformat code

* Use `isWithinSpreadAssignment` flag + `objectsWithinSpread` cache instead of ancestor traversal

* Revert "Use `isWithinSpreadAssignment` flag + `objectsWithinSpread` cache instead of ancestor traversal"

This reverts commit be387e3bbf.

* Expand on the existing comment
This commit is contained in:
Mateusz Burzyński
2022-08-09 02:01:50 +02:00
committed by GitHub
parent 71e8529228
commit 0e17dc7769
4 changed files with 107 additions and 9 deletions

View File

@@ -0,0 +1,15 @@
// @noEmit: true
// repro #49585
const { value } = (() => ({
value: "",
...(true ? {} : {}),
}))();
// repro 49684#discussion_r920545763
const { value2 } = {
value2: "",
...(() => true ? {} : {})(),
};