JSDoc import typedef from typescript library

How can I get intellisense in webstorm for types found in 3rd party libraries written in typescript?  It works in file in which I have explicitly imported the module, however if I pass an object into another module that does not import it, adding a JSDoc type definition does not work. 

Example:

/**
* @param {import('botkit').SlackController} slackController
*/

function myFunction(slackController) {

    slackController.

}

 

 

This works in VSCode, but not in WebStorm.

In WebStorm if I add 

const botkit = require('botkit');

to the top of the file, and then change the JSDoc comment to the following:


/**
* @param {botkit.SlackController} controller foo
*/


Then it works, however I don't think this is valid JSDoc, and it doesn't work in VSCode.

1 comment
Comment actions Permalink

Unlike @param {import('botkit').SlackController}, @param {botkit.SlackController} is a valid JSDoc... Not sure why it doesn't work in VSCode.

import()-types in JSDoc are not currently supported by WebStorm, please follow https://youtrack.jetbrains.com/issue/WEB-31971 for updates.

1

Please sign in to leave a comment.