Skip to main content

no-duplicate-type-param-tags

Disallow duplicate generic tags (@typeParam / @template) for the same type parameter name.

Targeted pattern scopeโ€‹

This rule checks TypeDoc comments on generic declarations (functions, methods, classes, interfaces, and type aliases).

What this rule reportsโ€‹

This rule reports when a type parameter name is documented multiple times in one comment block.

Why this rule existsโ€‹

Duplicate generic docs introduce conflicting descriptions and reduce documentation clarity for API consumers.

โŒ Incorrectโ€‹

/**
* Identity helper.
* @typeParam TValue Value type.
* @template TValue Duplicate value type.
* @param value Input value.
* @returns Same value.
*/
export function identity<TValue>(value: TValue): TValue {
return value;
}

โœ… Correctโ€‹

/**
* Identity helper.
* @typeParam TValue Value type.
* @param value Input value.
* @returns Same value.
*/
export function identity<TValue>(value: TValue): TValue {
return value;
}

Behavior and migration notesโ€‹

The rule reports duplicates but does not autofix, since choosing which content to keep is semantic.

ESLint flat config exampleโ€‹

import typedocPlugin from "eslint-plugin-typedoc";

export default [
{
plugins: { typedoc: typedocPlugin },
rules: {
"typedoc/no-duplicate-type-param-tags": "error",
},
},
];

When not to use itโ€‹

Disable only if your team intentionally duplicates generic docs (rare and usually accidental).

Package documentationโ€‹

TypeDoc package documentation:

Further readingโ€‹

Rule catalog ID: R016

Adoption resourcesโ€‹

  • Pair with require-type-param-tags and no-extra-type-param-tags for strong generic-doc consistency.