Skip to main content

require-type-param-tags

Require @typeParam tags for documented generic declarations.

Targeted pattern scopeโ€‹

This rule checks documented declarations that declare generic type parameters:

  • function declarations and declared functions,
  • methods,
  • classes,
  • interfaces,
  • type aliases.

What this rule reportsโ€‹

This rule reports missing type-parameter tags when a declaration has type parameters but its TypeDoc block omits one or more @typeParam entries.

Why this rule existsโ€‹

Generic APIs are harder to consume when type parameters are undocumented. This rule ensures generated docs explain each generic parameter's intent.

โŒ Incorrectโ€‹

/**
* Map one value into another type.
* @typeParam TInput Input type.
* @param input Input value.
* @param mapper Mapping function.
* @returns Mapped value.
*/
export function mapValue<TInput, TOutput>(
input: TInput,
mapper: (value: TInput) => TOutput
): TOutput {
return mapper(input);
}

โœ… Correctโ€‹

/**
* Map one value into another type.
* @typeParam TInput Input type.
* @typeParam TOutput Output type.
* @param input Input value.
* @param mapper Mapping function.
* @returns Mapped value.
*/
export function mapValue<TInput, TOutput>(
input: TInput,
mapper: (value: TInput) => TOutput
): TOutput {
return mapper(input);
}

Behavior and migration notesโ€‹

Autofix inserts TODO @typeParam entries for missing generic parameters directly into the existing doc block.

ESLint flat config exampleโ€‹

import typedocPlugin from "eslint-plugin-typedoc";

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

When not to use itโ€‹

Disable this rule when your API style intentionally avoids per-generic prose and relies solely on type signatures.

Package documentationโ€‹

TypeDoc package documentation:

Further readingโ€‹

Rule catalog ID: R007

Adoption resourcesโ€‹

  • Enable this rule after require-param-tags/require-returns-tag for full generic API coverage.