How can I have WebStorm Recognize and provide auto-completion for component names inside a custom Angular Library?
I'm currently having a problem with WebStorm recognizing a custom Angular library built using generate library. This library is published on NPM correctly - has all the umd, es2015, fes2015, etc. files and they are specified in the package.json. It's all done by the schematics, so it's probably correct.
I am correctly exporting all the modules and components into public-api.ts. Everything is accessible.
My project is using the published npm library correctly and is specifying the correct dependency and version of my custom library. Everything compiles and I can include components from this library into my Angular project, and I can see them in the browser rendering perfectly. Basically everything is working 100% except WebStorm doesn't detect any these components when using auto-complete like it does for other components.
I know for libraries like Material, WebStorm also works so I am curious what the Material developers did to get WebStorm to provide auto-completion here.
Does anyone have any idea?

Please sign in to leave a comment.
You have to include either your component sources (
.tsfiles) or the*.metadata.json(https://medium.com/@isaacplmann/getting-your-angular-2-library-ready-for-aot-90d1347bcad) in your published library package in order to get your components recognized by the static code analysis;For some reason, ngc is not creating a whole bunch of *.metadata.json files - I only see one at the root of the library. I suspect this is the problem, but after about an hour of playing with settings, I don't know how to get the cli to generate them the same way Material does. The cli build also does not include the sources as an alternative. I tried making sure it was emiting the metadata by setting:
inside the tsconfig.lib.json file, but that did not change anything.
Well, I gave up on trying to generate the metadata.json files, so I just used cpr in my build scripts to copy everything from projects/my-library/src/lib to dist/my-library/lib.
Thanks for your help! Hopes this thread helps someone else.