Files
Joe Martin (Crowdstaffing) 61894570f1 docs: improve markdown (#45590)
improve markdown for documentation. Duplicate of #45325 that targets 13.3.x.

PR Close #45590
2022-04-11 22:35:01 +00:00

1.1 KiB

@name Argument Not Literal @category compiler @shortDescription Decorator argument is not an object literal

@description

To make the metadata extraction in the Angular compiler faster, the decorators @NgModule, @Pipe, @Component, @Directive, and @Injectable accept only object literals as arguments.

This is an intentional change in Ivy, which enforces stricter argument requirements for decorators than View Engine. Ivy requires this approach because it compiles decorators by moving the expressions into other locations in the class output.

@debugging

Move all declarations:

const moduleDefinition = {…}

@NgModule(moduleDefinition) export class AppModule { constructor() {} }

into the decorator:

@NgModule({…}) export class AppModule { constructor() {} }

@reviewed 2022-02-28