Shravi
Shravi

Reputation: 29

Unresolved function or method in WebStorm Node Coding Assistance

I enabled Node coding assistance under "Settings -> Languages & Frameworks -> Node.js", yet it is not able to resolve EventEmitter functions like on() when extended to a child and also functions like fork() and variables like isMaster under node.js cluster module.

Any known bug or resolution tips ?

enter image description here

Upvotes: 0

Views: 550

Answers (1)

lena
lena

Reputation: 93868

Unfortunately due to a way cluster is defined in @types/node its inferred type is any, so no completion/resolving is possible:(

enter image description here

As a workaround, I'd suggest specifying the type explicitly with JSDoc:

/**
 * 
 * @type {module:cluster.Cluster}
 */
const cluster = require('cluster');

Upvotes: 2

Related Questions