Reputation: 1650
I have tried everything I can think of to get WebStorm to include the JOI package in my node.js project without throwing inspection warnings when I use its function. It works fine the way I have it written and causes no runtime errors. I have tried updating it, as well as explicitly installing it in "Preferences > Languages and Frameworks > Javascript > Libraries"
All of my other libraries I have installed through NPM behave fine and do not cause any inspector errors. However a simple statement liek
joi.string()
Causes an "Unresolved function or method string()" warning
How do I get rid of this? I have a whole file of validation so ignoring this line by line is not an options.
I have tried this with both the older and latest version of joi. The older version looks as follows:
const joi = require('joi');
const format = joi.string();
The newer version is:
const joi = require('@hapi/joi');
const format = joi.string();
Both behaved the exact same way within WebStorm and raised an inspection warning.
Upvotes: 1
Views: 241
Reputation: 2813
I found the following github issue: DefinitelyTyped#35440 that should be related to your problem.
Please install the newest @types
for the @hapi/joi
package with:
npm install --save @types/hapi__joi
Upvotes: 1