#Anyone have any experience adding .d.ts files to a JavaScript codebase just for Intellisense?

8 messages · Page 1 of 1 (latest)

raven dagger
#

I'm trying to add a .d.ts file to type the default export of a module, but I just can't get the types to show up in VS Code's intellisense, would love to see an example if anyone has or knows of one

warm bear
#

If there's a jsconfig, you'd need to add a "types" field. You can also include a reference comment in the files you are working on.

raven dagger
#

@warm bear thanks! yeah, just a jsconfig—do you have an example? I can't find any docs on the types field for jsconfig

#

@warm bear or do you mean a jsdoc that imports the .d.ts?

#

but then I would loose types for other libraries unless I listed each of them in the "types" field too, right?

#

okay, importing in a jsdoc with /** @type {import('./db.d.ts').DB} */ worked, ty!