fix(javascript): avoid invented computed destructuring properties (#507)

Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
This commit is contained in:
Rudy Mizrahi Celekli authored and GitHub committed 2026-10-05 14:59:10 +08:00
1 parent 2fd11961cf
commit 80777d96da
3 files changed
+46 -2

No files matched your search

@@ -170,6 +170,24 @@ it("projects built-in resource acquisition and release", () => {
).toMatchObject({ status: "partial" });
});
it("does not project a literal property slot for dynamic destructuring", () => {
const graph = graphFor(`
const source = { token: "TOKEN" };
const key = getKey();
const { [key]: value } = source;
`);
expect(
graph.relations.filter(({ relation }) => relation === "destructures"),
).toEqual([]);
expect(
graph.nodes.find(
({ kind, properties }) =>
kind === "property-slot" && properties.name === "key",
),
).toBeUndefined();
});
it("projects literal seeds and static object flow", () => {
const graph = graphFor(`
const source = { token: "TOKEN", count: 1 };