Ben McCann
Ben McCann

Reputation: 19014

Using interface defined in JSDoc in Typescript

I'm trying to setup TypeScript on a JS codebase with allowJs and checkJs

I have a JSDoc that uses an interface as a parameter type:

 * @param {IPlugin[]|IPlugin} plugins plugin instance(s).

In the same file, I have the interface defined via JSDoc:

/**
 * Plugin extension hooks.
 * @interface IPlugin
 * @since 2.1.0
 */

This looks like valid JSDoc to me. However, TypeScript is failing on it:

src/core/core.plugins.js:243:13 - error TS2304: Cannot find name 'IPlugin'.

243 * @param {IPlugin[]|IPlugin} plugins plugin instance(s).

Any ideas how I get this to work?

Upvotes: 4

Views: 3384

Answers (1)

Related Questions