Migrate constructor injection to inject()
Recipe ID
org.openrewrite.angular.migration.migrate-constructor-to-injectArtifact@openrewrite/recipes-angularConverts constructor parameter properties in Angular classes to field declarations using the inject() function. For example, constructor(private svc: MyService) {} becomes private svc = inject(MyService);.
Single recipeProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.angular.migration.migrate-constructor-to-injectIf the recipe isn’t available locally, install it with:
mod config recipes npm install @openrewrite/recipes-angular