Skip to main content

prefer-type-param-tag

Prefer @typeParam over @template in TypeDoc block comments.

Targeted pattern scopeโ€‹

This rule checks TypeDoc block comments and finds generic tags that use the @template alias.

What this rule reportsโ€‹

This rule reports every @template tag and autofixes it to @typeParam.

Why this rule existsโ€‹

TypeDoc supports @template, but @typeParam is the canonical tag form in modern TypeDoc docs. Standardizing on one tag improves consistency and readability.

โŒ Incorrectโ€‹

/**
* Identity helper.
* @template TValue 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โ€‹

Autofix is safe and textual: only the tag identifier is rewritten.

ESLint flat config exampleโ€‹

import typedocPlugin from "eslint-plugin-typedoc";

export default [
{
plugins: { typedoc: typedocPlugin },
rules: {
"typedoc/prefer-type-param-tag": "error",
},
},
];

When not to use itโ€‹

Disable this rule only if your project intentionally standardizes on @template.

Package documentationโ€‹

TypeDoc package documentation:

Further readingโ€‹

Rule catalog ID: R010

Adoption resourcesโ€‹

  • Run with --fix once to normalize historical comments quickly.