I have two NPM modules, let's call them A and B.
Both written in TypeScript. Both compiles into CommonJS Node-like modules.
Module B depends on module A, so I install in with npm install --save A
. It have been properly installed into node_modules/A
folder.
Then in my new module B I want to use class Class
from module A. So I write:
// 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 is PhpStorm (version 2016.3.2) does not suggest to add any import statement like it does for local project files. TypeScript Service says that class name not found and PhpStorm only suggests to rename class Class
.
Is there any possibility to say PhpStorm to give me suggestions, code completition for modules written in TypeScript and distributed via NPM?
I think the number of TypeScript modules grows over time and it's much easier in TypeScript projects to use TypeScript code directly from modules, without .d.ts files.
main
key of the A package look like? That will point to the main module. It would be something likeimport Class from "A"
orimport { Class } from "A"
, or some other variation, depending on how you exported it. A link to the npm package or its repository would also help so people can investigate it better. - zehTransition
placed in filelib/UI/Animation/Transition.ts
under A module and exported asdefault
. Inside module B I import it usingimport Transition from 'A/lib/UI/Animation/Transition';
. And PhpStorm does not suggest to import this file automatically, i must write imports myself. - Alex Chandler