-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
Using generics on both an ES5 class and methods results in incomplete type resolution.
🔎 Search Terms
jsdoc, template, generic
🕗 Version & Regression Information
Typescript 4.4.4, 4.5.0-beta
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about JSDoc/generics/templates
⏯ Playground Link
Playground link with relevant code
💻 Code
/**
* @template {string} T
* @param {T} t
*/
function Cls(t) {
this.t = t;
}
/**
* @template {string} V
* @param {T} t
* @param {V} v
*/
Cls.prototype.func1 = function (t, v) {
};
Cls.prototype.func2 =
/**
* @template {string} V
* @param {T} t
* @param {V} v
*/
function (t, v) {
};
var c = new Cls('a');
c.func1('a', 'b'); //Can't resolve V generic
c.func2('a', 'b'); //Can't T generic in argument
🙁 Actual behavior
Unable to resolve type for all generics defined in the JSDOC
🙂 Expected behavior
All generics should resolve to actual types.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationFix AvailableA PR has been opened for this issueA PR has been opened for this issue