no-extra-type-param-tags
Disallow stale generic tags (@typeParam/@template) that do not map to declared type parameters.
Targeted pattern scopeโ
This rule checks documented generic declarations:
- function declarations and declared functions,
- methods,
- classes,
- interfaces,
- type aliases.
What this rule reportsโ
This rule reports generic documentation tags whose names are not present in the declaration's generic type parameter list.
Why this rule existsโ
Generic signatures change frequently. Stale generic tags are hard to spot manually and can mislead generated docs.
โ Incorrectโ
/**
* Build a pair.
* @typeParam TLeft Left type.
* @typeParam TRight Right type.
* @typeParam TExtra Stale generic.
* @param left Left value.
* @param right Right value.
* @returns Pair tuple.
*/
export function pair<TLeft, TRight>(left: TLeft, right: TRight): [TLeft, TRight] {
return [left, right];
}
โ Correctโ
/**
* Build a pair.
* @typeParam TLeft Left type.
* @typeParam TRight Right type.
* @param left Left value.
* @param right Right value.
* @returns Pair tuple.
*/
export function pair<TLeft, TRight>(left: TLeft, right: TRight): [TLeft, TRight] {
return [left, right];
}
Behavior and migration notesโ
This rule accepts both @typeParam and @template as generic tags, and only validates name mapping.
ESLint flat config exampleโ
import typedocPlugin from "eslint-plugin-typedoc";
export default [
{
plugins: { typedoc: typedocPlugin },
rules: {
"typedoc/no-extra-type-param-tags": "error",
},
},
];
When not to use itโ
Disable this rule during intermediate migrations where docs are intentionally ahead of code changes.
Package documentationโ
TypeDoc package documentation:
Further readingโ
Rule catalog ID: R009
Adoption resourcesโ
- Combine with
require-type-param-tagsfor complete and accurate generic docs.