-
Couldn't load subscription status.
- Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generation
Milestone
Description
Bug Report
π Search Terms
jsdoc name resolve lookup symbol template constraint typedef
π Version & Regression Information
- This has been an issue since we added support for
@templatein JSDoc
β― Playground Link
Playground link with relevant code
π» Code
/**
* @template T
* @template {keyof T} K
* @typedef Foo
*/π Actual behavior
Reports Cannot find name `T`.
π Expected behavior
Does not report an error.
Notes
Name resolution does not look at the symbol table of the @typedef tag, so when looking for T in the code below, we end up looking at T for the function declaration further down in this example:
/**
* @template T
* @template {keyof T} K
* @typedef Foo
*/
/**
* @template T
* @param {T} a
*/
function bar(a) {
}A "go-to-definition" on the T in keyof T jumps to the T declared for bar, not the T in the typedef for Foo.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generation