Closed
Description
TypeScript Version: 3.9.2, 3.8.3, next
Search Terms: mapped types jsdoc
Code
/**
* @template T
* @param {T} a
* @param {{[K in keyof T]: (value: T[K]) => void }} b
*/
function f(a, b) {
}
f({ x: 42 }, { x(param) { } });
Expected behavior:
I expected param
to be of type number
, like it is when the function is defined in TS.
Actual behavior:
param
is of type { x: number }[K]
, even though K
has no meaning/can't be bound in this context.
Playground Link: playground
Related Issues:
This occurs when defining the function in JS through JSDoc, even when used in TS.
When defined in TS, it works in JS as well.