Open Kiskae opened 3 weeks ago
Thanks for opening this issue @Kiskae
Currently, what we can do to not break the whole app during migration, is to just skip the components that extend a class, and skip classes that are extended.
Edit: Later on, we can also add support for these cases too ofc.
What do you think?
Its probably hard to avoid breaking some parts of the app during this migration, especially when inheritance is involved since it changes constructors.
imho it might be an idea to run the upgrade as usual, but bail on the file and emit a warning if it finds a constructor with a this
parameter.
It might be possible that the migration works just fine once the super(...)
has been reduced to super()
. I've not checked whether that resolves the issue.
When migrating an entire project at once, the additional metadata available to
ts-morph
appears to change the AST and causes erroneous changes to the code.Steps to reproduce:
ng g application ngxtension-bug
base.component.ts
extend.component.ts
ng g ngxtension:convert-di-to-inject --project=ngxtension-bug
extend.component.ts
file now looks like this:Other observations:
--path
isnt affected, hence my suspicion its the additional metadata available when all files are loaded at the same time.this
I suspect its related:this
after https://github.com/ngxtension/ngxtension-platform/blob/3.5.2/libs/plugin/src/generators/convert-di-to-inject/generator.ts#L127 fixes the crash, but this also results in broken code that needs to be manually fixed.angular version:
17.3.11
ngxtension version:3.5.2