@@ -2116,6 +2116,10 @@ namespace ts {
21162116 result = addRange ( result , getJSDocParameterTags ( node as ParameterDeclaration ) ) ;
21172117 break ;
21182118 }
2119+ if ( node . kind === SyntaxKind . TypeParameter ) {
2120+ result = addRange ( result , getJSDocTypeParameterTags ( node as TypeParameterDeclaration ) ) ;
2121+ break ;
2122+ }
21192123 node = getNextJSDocCommentLocation ( node ) ;
21202124 }
21212125 return result || emptyArray ;
@@ -4994,15 +4998,14 @@ namespace ts {
49944998 /**
49954999 * Gets the JSDoc parameter tags for the node if present.
49965000 *
4997- * @remarks Returns any JSDoc param tag that matches the provided
5001+ * @remarks Returns any JSDoc param tag whose name matches the provided
49985002 * parameter, whether a param tag on a containing function
49995003 * expression, or a param tag on a variable declaration whose
50005004 * initializer is the containing function. The tags closest to the
50015005 * node are returned first, so in the previous example, the param
50025006 * tag on the containing function expression would be first.
50035007 *
5004- * Does not return tags for binding patterns, because JSDoc matches
5005- * parameters by name and binding patterns do not have a name.
5008+ * For binding patterns, parameter tags are matched by position.
50065009 */
50075010 export function getJSDocParameterTags ( param : ParameterDeclaration ) : ReadonlyArray < JSDocParameterTag > {
50085011 if ( param . name ) {
@@ -5023,6 +5026,22 @@ namespace ts {
50235026 return emptyArray ;
50245027 }
50255028
5029+ /**
5030+ * Gets the JSDoc type parameter tags for the node if present.
5031+ *
5032+ * @remarks Returns any JSDoc template tag whose names match the provided
5033+ * parameter, whether a template tag on a containing function
5034+ * expression, or a template tag on a variable declaration whose
5035+ * initializer is the containing function. The tags closest to the
5036+ * node are returned first, so in the previous example, the template
5037+ * tag on the containing function expression would be first.
5038+ */
5039+ export function getJSDocTypeParameterTags ( param : TypeParameterDeclaration ) : ReadonlyArray < JSDocTemplateTag > {
5040+ const name = param . name . escapedText ;
5041+ return getJSDocTags ( param . parent ) . filter ( ( tag ) : tag is JSDocTemplateTag =>
5042+ isJSDocTemplateTag ( tag ) && tag . typeParameters . some ( tp => tp . name . escapedText === name ) ) ;
5043+ }
5044+
50265045 /**
50275046 * Return true if the node has JSDoc parameter tags.
50285047 *
0 commit comments