In a TypeScript file, how can I write JSDoc documentation for the generic type parameter of a function?
In the following dummy example, I tried to use @param T
to provide documentation on the generic type parameter T
:
/**
* A function that processes an array.
* @param arr The array to be processed.
* @param T The type of each element in the array.
*/
function processArray<T>(arr: T[]) {
console.log(arr);
/* ... */
}
(Link to TypeScript playground)
When I hover over the function parameter arr
, the documentation tooltip can show the description that I provided via @param arr
.
However, when I hover over the generic type parameter T
, it does not show the documentation that I provided via @param T
:
Which JSDoc tag should I use such that the documentation can show inside the tooltip of the generic type parameter? If that is not supported, is it a good practice to use the @param
tag (e.g. @param T
)?