Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to get rid of "Imports array contains unused imports(-998113)"

Ever since I’ve upgraded my app to the latest version of Angular (18.2.0), I’m getting this warning message in many of the components:

Imports array contains unused imports(-998113)

Now, I understand the meaning of this and why it’s showing up like that, and basically it’s great that it exists, to let me know (although it doesn’t say which import(s) are not used!).
But nevertheless, I don’t want it to appear, and without removing unused imports.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is there a setting or a configuration that I can use to stop getting these warning message?

>Solution :

You can try upgrading the plugin Angular Language Service to the latest version and probably turn on the auto update checkbox (so that the plugin always has the latest version). If that does not work out try the below suggestion.


This seems to be present in the documentation under:

NG8113 – Unused Standalone Imports

This diagnostic detects cases where the imports array of a @Component contains symbols that aren’t used within the template.

Check if there are any imports that you are not using.

@Component({
  imports: [UsedDirective, UnusedPipe]
})
class AwesomeCheckbox {}

If you feel what you have is correct and it seems to bug out, you can temporarily disable it, using tsconfig.json, until it get’s fixed in a later release, but you must raise a bug on angular github (if you feel it’s a bug).

{
  "angularCompilerOptions": {
    "extendedDiagnostics": {
      "checks": {
        "unusedStandaloneImports": "suppress"
      }
    }
  }
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading