Open
Description
/**
* @template T
* @param {T} a
* @return {typeof a}
*/
function f(a) {
return a;
}
Today, this gives the following error (playground link):
* @return {typeof a}
~
error: Cannot find name 'a'.
However, if you add an outer declaration of a
(playground link):
let a = 123;
/**
* @template T
* @param {T} a
* @return {typeof a}
*/
function f(a) {
return a;
}
typeof a
"correctly" resolves to the outer a
(and you can see so with the error), but go-to-definition and find-all-references resolve locally to the parameter, not the outer local.