diff --git a/src/test/converter2/issues/gh941.ts b/src/test/converter2/issues/gh941.ts new file mode 100644 index 000000000..5702549f4 --- /dev/null +++ b/src/test/converter2/issues/gh941.ts @@ -0,0 +1,7 @@ +export const propertyName1 = "p1"; +export const propertyName2 = Symbol(); + +export const Obj = { + [propertyName1]: "foo", + [propertyName2]: "bar", +}; diff --git a/src/test/issues.c2.test.ts b/src/test/issues.c2.test.ts index 8fcb8a56f..35117c3e9 100644 --- a/src/test/issues.c2.test.ts +++ b/src/test/issues.c2.test.ts @@ -120,6 +120,19 @@ describe("Issue Tests", () => { ok(nsFoo.children?.find((r) => r.name === "x")); }); + it("Supports computed names #941", () => { + const project = convert(); + const obj = query(project, "Obj"); + equal( + obj.type?.visit({ + reflection(r) { + return r.declaration.children?.map((c) => c.name); + }, + }), + ["[propertyName2]", "p1"], + ); + }); + it("#1124", () => { const project = convert(); equal(