I am trying to annotate a property of an object which is an argument to a function.
Specifically I want options.length explanation to appear in vscode when hovering over the function definition.
/**
* Memoize a function
* @param {(...fnArgs: T[]) => U} fn The function to memoize
* @param {Object} options Memoization options
* @param {number} options.max The max size of the LRU cache
* @param {number | undefined} options.length The response will be cached
* by the first N args, based on this value. Trailing args will still be
* passed to the underlying function but will be ignored during memoization.
*/
export const memo = <T, U>(
fn: (...fnArgs: T[]) => U,
{ max, length }: { max: number; length?: number }
) => {
const cachedArgs: T[][] = []
const cachedValues: U[] = []
const get = (args: T[]): U | undefined => {
const index = cachedArgs.findIndex(x => argsAreEqual(x, args, length))
if (index === -1) return
onUsed(index)
return cachedValues[index]
}
const set = (args: T[], value: U) => {
cachedArgs.push(args)
cachedValues.push(value)
}
const onUsed = (index: number) => {
moveToEnd(index, cachedArgs)
moveToEnd(index, cachedValues)
}
const prune = () => {
if (cachedArgs.length >= max) {
cachedArgs.shift()
cachedValues.shift()
}
}
return (...args: T[]) => {
let value = get(args)
if (value) return value
prune()
value = fn(...args)
set(args, value)
return value
}
}
When hovering over the type signature I get the following
@param fn — The function to memoize
@param options — Memoization options
I've done my best to copy from the docs but it doesn't show the explanation for options.length.
I want it to show the explanation for how the options.length parameter works. How can I do this?
Bonus question, not sure how to make the generics work with jsdoc either... help with @template much appreciated!

@propor@propertyinstead, like this?Objectwould prevent@paramfrom working, but the linked issues seemed to indicate that would happen.