-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specificallyDomain: Symbol NavigationRelates to go-to-definition, find-all-references, highlighting/occurrences.Relates to go-to-definition, find-all-references, highlighting/occurrences.
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.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specificallyDomain: Symbol NavigationRelates to go-to-definition, find-all-references, highlighting/occurrences.Relates to go-to-definition, find-all-references, highlighting/occurrences.