Crystal-Spider/jsdoc-generator

What about generic extends in Typescript

Closed this issue · 2 comments

The code:

const sayHello = <N extends string>(name: N): `Hello, ${N}` => {
	return `Hello, ${name}`;
};

Generating:

/**
 * Description placeholder
 *
 * @template N
 * @param {N} name
 * @returns {`Hello, ${N}`}
 */

But should be

/**
 * Description placeholder
 *
 * @template {string} N <-- extends string
 * @param {N} name
 * @returns {`Hello, ${N}`}
 */

I should also add support for default values for type parameters.
I'm attaching here a link to the official JSDoc documentation so that when I start working on this I have the reference guide: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template

Keep an eye on the v2.0.0 release because it's the one that will have the fix for this issue!