I am facing an issue with two NPM modules, which we will refer to as A and B.
Both modules are written in TypeScript and compile into CommonJS Node-like modules.
Module B has a dependency on module A, so I have installed it using the command npm install --save A
. It has been successfully installed in the node_modules/A
folder.
Now, in my new module B, I want to use the class Class
from module A. Here is my code snippet:
// import Class from 'A/lib/Class'; <- This import statement must be suggested by PhpStorm
export default class NewClass extends Class {
// boring implementation details
}
The problem I am encountering is that PhpStorm (version 2016.3.2) does not provide any suggestions for adding an import statement like it does for local project files. The TypeScript Service indicates that the class name is not found, and PhpStorm only suggests renaming the class Class
.
Is there a way to instruct PhpStorm to offer suggestions and code completion for TypeScript modules distributed via NPM?
I believe the number of TypeScript modules is increasing over time, and it would be more convenient in TypeScript projects to directly use TypeScript code from modules without .d.ts files.