Visitar URL original
Angular Language Service flags non-Angular TypeScript classes by method name (ngOnInit) in Nx monorepo · Issue #66598 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20260218214550/https://github.com/angular/angular/issues/66598
Skip to content

Angular Language Service flags non-Angular TypeScript classes by method name (ngOnInit) in Nx monorepo #66598

@AntonPolyakin

Description

@AntonPolyakin

Which @angular/* package(s) are the source of the bug?

language-service

Is this a regression?

No

Description

Angular Language Service (ALS) incorrectly reports an error in non-Angular TypeScript libraries inside an Nx monorepo when a class contains methods named like Angular lifecycle hooks (e.g. ngOnInit).

The diagnostic shown is:

Class is using Angular features but is not decorated. Please add an explicit Angular decorator.

This happens even when:

  • the project is not Angular
  • there are no Angular decorators
  • the library is built with @nx/js:tsc
  • ESLint rules are disabled
  • the file is not part of any Angular compilation

The error disappears immediately when the Angular Language Service extension is disabled, confirming ALS as the source.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)


Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussionarea: vscode-extensionIssues related to the Angular Language Service VsCode extension

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions