eslint-plugin-jsdoc 65.3.11 → 65.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -163,5 +163,5 @@
163
163
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
164
164
  "test-index": "pnpm run test-no-cov test/rules/index.js"
165
165
  },
166
- "version": "65.3.11"
166
+ "version": "65.3.12"
167
167
  }
@@ -914,13 +914,24 @@ export default iterateJsdoc(({
914
914
  return;
915
915
  }
916
916
 
917
- if (parent?.type === 'JsdocTypeFunction' &&
918
- /** @type {import('jsdoc-type-pratt-parser').FunctionResult} */
919
- (parent)?.typeParameters?.some((typeParam) => {
917
+ // Type parameters of a function type or signature (e.g.,
918
+ // `<T>(x: T) => T` or `{<T>(x: T): T}`) are in scope anywhere
919
+ // within that function type
920
+ /**
921
+ * @type {import('jsdoc-type-pratt-parser').NonRootResult & {
922
+ * _parent?: import('jsdoc-type-pratt-parser').NonRootResult,
923
+ * typeParameters?: import('jsdoc-type-pratt-parser').TypeParameterResult[]
924
+ * }|undefined}
925
+ */
926
+ let ancestor = parent;
927
+ while (ancestor) {
928
+ if (ancestor.typeParameters?.some((typeParam) => {
920
929
  return value === typeParam.name.value;
921
- })
922
- ) {
923
- return;
930
+ })) {
931
+ return;
932
+ }
933
+
934
+ ancestor = ancestor._parent;
924
935
  }
925
936
 
926
937
  if (parent?.type === 'JsdocTypeInfer' && value === parent.element.value) {