WebStorm is not detecting type definitions in npm package

I have written an npm module with TypeScript, with the hopes that it can be consumed in node projects with enhanced code assistance. The package.json has a "typings" property pointing to a published `.d.ts` file. However, when I require the module in a node project, I receive no type hints.

Does WebStorm import referenced .d.ts files when doing a require in JavaScript code? 

4 comments
Comment actions Permalink

Webstorm does use "typings" when resolving types in JS code.

Can you provide a sample project that shows up the issue?

0
Comment actions Permalink

Please share a sample project the issue can be recreated with

0
Comment actions Permalink

It's partially working for me. The auto-completion doesn't filter out what is exposed in the index.d.ts.

In short the completion works but it's useless because it's lost in the list of other suggestions.

 

@Elena It should either restrict to what's defined in the index.d.ts (drop the rest) or at least put the suggestions coming from the definition file first in the pop-up list.

I said partially because it doesn't propose me anything for function arguments.

0
Comment actions Permalink

Please see above - I can hardly help unless I have a project to play with

0

Please sign in to leave a comment.