tI have this code:
const Gatherer = require('../gatherer');
class MetaRobots extends Gatherer {
/**
* @param {{driver: !Driver}} options Run options
…
}
module.exports = MetaRobots;
VSCode highlights Driver
(inside jsdoc) because it's unable to find its definition. However, the definition of that class is in the same project:
class Driver {
…
}
module.exports = Driver;
Importing Driver
in the MetaRobots
file ( const Driver = require('../../driver');
) fixes the issue, but then I have an unused import.
Can't find definition of Driver 😢
Can find definition of Driver, but Driver import is unused 😢
Is there any way I can hint VSCode about definition of Driver
w/o importing it?
[EDIT] Additional info:
It seems it's not a problem with the vscode itself but rather an issue with the TypeScript server running underneath.
Unfortunately, currently you need to import Connection
in the driver.js
file for IntelliSense to pick up the types properly. It's being discussed on how it should be solved. There is also an issue describing very similar case.
You can try experimenting with type definitions files and UMD modules but it might not work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.