point WebStrom to use correct Database class from JSDoc for coding assistance

If I use `@type {Database}`:

WebStorm thinks that this type is from this file:

However I want to use class definition from JSDoc from this file/library for coding assistance:

Is there any possibility to force WebStorm to do/use this?

0
7 comments

Try using 

@type {IDatabase}

- this is the interface defined in node_modules/pg-promise/typescript/pg-promise.d.ts

0
Avatar
Permanently deleted user

IDatabase does not have methods, that I need. E.g.

db.none
db.one
db.any
0

they are defined in IBaseProtocol extended by IDatabase

0
Avatar
Permanently deleted user

In general - I can not force WebStorm to use "Database" class description from library, right?
And workaround IBaseProtocol - will not work. Looks like Webstorm does not use "typescript" suggestions inside ".js" file.

0
Avatar
Permanently deleted user

The same picture you will see with "IDatabase"

0

Try adding a namespace:

/**
*
* @type {pgPromise.IDatabase}
*/
const db = pgp(config)

1
Avatar
Permanently deleted user

Ok. This workaround works! Thanks!

0

Please sign in to leave a comment.