#Anyone have any experience adding .d.ts files to a JavaScript codebase just for Intellisense?
8 messages · Page 1 of 1 (latest)
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.
@warm bear thanks! yeah, just a jsconfig—do you have an example? I can't find any docs on the types field for jsconfig
Although I did find this https://stackoverflow.com/questions/32296299/including-d-ts-type-definition-files-in-vscode
@warm bear or do you mean a jsdoc that imports the .d.ts?
Ah I'm guessing you're talking about https://www.typescriptlang.org/tsconfig#types
From allowJs to useDefineForClassFields the TSConfig reference includes information about all of the active compiler flags setting up a TypeScript project.
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!