ts-migrate icon indicating copy to clipboard operation
ts-migrate copied to clipboard

Broken code gen in strict mode with functions on object attributes

Open kwojcik opened this issue 3 years ago • 2 comments

Forgive my poor issue title because I don't know the exact issue, but I've got a perfect minimal repro for you https://github.com/kwojcik/ts-migrate-bug.

The generated code has extra })'s and breaks.

kwojcik avatar Aug 19 '22 00:08 kwojcik

diff --git a/src/Property.js b/src/Property.js
index 7aba662..12cf253 100644
--- a/src/Property.js
+++ b/src/Property.js
@@ -7,8 +7,9 @@ export default class Property {
   overview() {
     return flatten(this.foos.map(foo =>
       Object.entries(groupBy(foo.foo, 'bar')).map(() => {
+        const { fooType } = foo;
         return {
-          name: `${foo.fooType}`,
+          name: `${fooType}`,
         };
       })
     ));

this change to the src fixes it

kwojcik avatar Aug 19 '22 00:08 kwojcik

I met the same issue

oltodo avatar Nov 17 '22 21:11 oltodo