{ "id": "errors/NG1001", "title": "NG1001: Decorator argument is not an object literal", "contents": "

NG1001: Decorator argument is not an object literallink

\n
\n mode_edit\n
\n\n\n\n\n
\n

Descriptionlink

\n

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

\n

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.

\n\n
\n
\n
\n

Debugging the errorlink

\n

Move all declarations:

\n\nconst moduleDefinition = {...}\n\n@NgModule(moduleDefinition)\nexport class AppModule {\n constructor() {}\n}\n\n

into the decorator:

\n\n@NgModule({...})\nexport class AppModule {\n constructor() {}\n}\n\n\n
\n\n\n" }