Is there a way to use JSDoc comments to annotate a function that accepts and returns an object of the same type? For example, something like this:
/**
* Performs a task and returns an object of the same type
* @param {T extends Object} src Source object
* @returns {T} An object of the same type
*/
function chainFoo(src) {
// do some work
return Object.assign({}, src); // just as an example
}
Can this be done?