`generic` causing error
Closed this issue · 4 comments
Hey @UnrefinedBrain ! Really glad that you made this library, and it has been super easy to use! I'm implementing the code transformation for shadcn-vue however I run into issue with SFC with generic.
Steps to recreate:
- Transform a SFC string with
generic="T extends Record<string, any>"
- Observe error
Cannot read properties of undefined (reading 'length')
Edit: After digging deeper, seems like vue-eslint-parser
issue, however I'm not sure if it's the parser
config issue
Seems to be a small AST difference between @babel/parser
and @typescript-eslint/parser
, which is fixed by babel/babel#12829
However, Babel 8 has not yet released. I'll try some things to work around it
I opened a PR for vue-eslint-parser to fix this issue: vuejs/vue-eslint-parser#236
vue-eslint-parser maintainer doesn't want to merge the change. We can either use an alpha version of babel 8 or make a local patch for vue-eslint-parser
I think for now I will do a local patch, and update to babel v8 as a real fix once it releases.
update: bundling local patch is harder than I thought. Maybe we need to use alpha version after all
I published 3.1.13 which should hopefully fix this issue by upgrading babel to v8. at least, my test case is passing now.
Can you let me know if it worked for you?