4 ms·
Agree, any complex types just get placed in their own `.d.ts` file, and import that into JSDoc comments /// Top of file usually /** * @typedef {import('
by syspec 3y ago
Agree, any complex types just get placed in their own `.d.ts` file, and import that into JSDoc comments
/// Top of file usually
/**
* @typedef {import('./typedefs/MyThing')} MyThing
*/
/// Later
/**
* @param {MyThing} x
*/
function(x) {
//
}
- fenomas 3y agoWorth noting that you can also do this from plain .js files. /** @param { import('./foo.js').SomeType } arg */ function doThing(arg) { // ... } The thing being imported can be a JS thing like an exported class, or a JSDoc type that's defined with @typedef.