Questions tagged [tsd-jsdoc]

3 questions
2
votes
0 answers

What is the JSDoc syntax to consistently define a callback with a generic?

I have the following JSDoc definition of an identity function: /** * @template T * @callback id * @param {T} x * @returns {T} */ When I use it with a plain function definition, it works as expected, no complaints: import { writable, derived }…
Dom Christie
  • 4,152
  • 3
  • 23
  • 31
0
votes
1 answer

JSDoc generic typedef for TypeScript function

I'm using JSDoc in a mjs to mimic a ts function that I have. The mjs is checked using the TypeScript compiler. The original function (overloaded), from ts file is like this: export function inline
Adrian Miranda
  • 315
  • 3
  • 9
0
votes
0 answers

JSDoc with tsd-jsdoc for higher-order functions has bad output

I am using this npm command to build types from jsdoc: "build-types": "jsdoc -t node_modules/tsd-jsdoc/dist -r src -d ./dist" For this function: /** * * @param {number} a * @returns {function(number): number} */ const add = a => b => a +…
Ragnar
  • 4,292
  • 4
  • 31
  • 41