Angular Inspection False Positive with OOB CLI project?

Specifically, the "Invalid imported or declared symbol" inspection.

Here are the steps I took to get this error, but I don't know if I'm doing something wrong, or if this is an actual false positive.

  1. Create New Project > Angular CLI (In the "Additional Parameters" field, add --createApplication=false)
  2. After the CLI does it's thing, in a terminal window execute 'ng generate application my-application'
  3. Then, execute 'ng generate library my-library'
    - Note that the root tsconfig file has been updated to include a path that points to the local dist folder, so we have to build before we can use it
  4. Execute 'ng build my-library'. Since it's a default library, it should build without any errors.
  5. Go to projects/my-application/src/app/app.module.ts
  6. Import your library's module via import { MyLibraryModule } from 'my-library';
  7. Add MyLibraryModule to AppModule's imports. The Inspection marks it as an invalid import.

Thanks for any info or guidance on this!

Edited to add: This is with WebStorm 2019.1

4 comments

>Add MyLibraryModule to AppModule's imports. The Inspection marks it as an invalid import

please can you attach a screenshot of the error?

Note that dist is auto-excluded due to https://youtrack.jetbrains.com/issue/WEB-30918 for better performance.

Try marking it as "not excluded" (from the folder right-click menu, choose Mark directory as/Not Excluded) - does it help?.

0

Marking the dist folder as not excluded does fix the problem. I can probably tweak this behavior by having my CLI libraries output to a folder besides dist, so that gets me past the immediate issue. Not sure if you guys want to put any thought around auto excluding dist except for projectTypes of "library". It's not difficult to change the build options for libraries, but since this was OOB settings, not sure how you want to handle that.

I've attached the screeshot for completeness.

0

Please sign in to leave a comment.