File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1240,5 +1240,16 @@ class Test {}
12401240 * @template {Test} T
12411241 * @typedef {T extends Test<infer I> ? I : never} TestType
12421242 */
1243+
1244+ /**
1245+ * @template T
1246+ */
1247+ class Test {
1248+ /** @typedef {T} Type */
1249+ /** @type {Type} */
1250+ t;
1251+ }
1252+
1253+ console .log (Test );
12431254````
12441255
Original file line number Diff line number Diff line change @@ -235,9 +235,15 @@ export default iterateJsdoc(({
235235 ancestorNodes . flatMap ( ( ancestorNode ) => {
236236 return getTemplateTags ( ancestorNode ) ;
237237 } ) :
238- utils . getPresentTags ( [
239- 'template' ,
240- ] ) ;
238+ // We err on the side of being too aggressive; checking only
239+ // present tags is not sufficient
240+ comments . flatMap ( ( doc ) => {
241+ return doc . tags . filter ( ( {
242+ tag,
243+ } ) => {
244+ return tag === 'template' ;
245+ } ) ;
246+ } ) ;
241247
242248 const closureGenericTypes = templateTags . flatMap ( ( tag ) => {
243249 return utils . parseClosureTemplateTag ( tag ) ;
Original file line number Diff line number Diff line change @@ -2137,5 +2137,19 @@ export default /** @type {import('../index.js').TestCases} */ ({
21372137 */
21382138 ` ,
21392139 } ,
2140+ {
2141+ code : `
2142+ /**
2143+ * @template T
2144+ */
2145+ class Test {
2146+ /** @typedef {T} Type */
2147+ /** @type {Type} */
2148+ t;
2149+ }
2150+
2151+ console.log(Test);
2152+ ` ,
2153+ } ,
21402154 ] ,
21412155} ) ;
You can’t perform that action at this time.
0 commit comments