JavaScript project with global typescript definitions in VS Code?

250 Views Asked by At

I have been trying to figure this out for the longest time. Let's say I have a Node.js project that uses .js files. Let's also say that I have a custom definition.d.ts file I want to use to provide Intellisense auto-completes when using proper a JSDoc set up, like this:

/** @type {TypeDefinedInExternalFile} */
let x = someValue;

Now every place on the internet says to just stick a reference path at the top of the file, like this:

/// <reference path="path/to/definition.d.ts" />

Sure, that works great. The JSDoc type field autocompletes to it, and now Intellisense knows whats up but just for that file.

I have a very large project with tons of modules, obviously I don't want to put that reference path snippet at the top of every single file. How do I set this up?

I have tried every possible confliguration of jsconfig.json and tsconfig.json and using some index.d.ts file to put reference paths in, and none of that has worked.

0

There are 0 best solutions below