What it measures

A Long Parameter List is a classic code smell from Fowler's Refactoring: functions with many parameters are harder to call correctly, harder to test, and often a sign that the function is doing too much or that related data should be grouped into an object.

tsmetrics reports the parameter count for every function and flags those exceeding the threshold (default: 4).

How it's computed

tsmetrics counts formal parameters in the function signature. Destructured object parameters count as one parameter regardless of how many properties are destructured.

is_long = param_count > threshold (default threshold: 4)

Examples

TypeScript — 5 params (flagged)
function createUser(
  name: string,
  email: string,
  age: number,
  role: string,
  active: boolean   // 5 params → flagged
) { /* … */ }
TypeScript — refactored with object param (1 param)
interface CreateUserOptions {
  name: string; email: string; age: number;
  role: string; active: boolean;
}

function createUser(opts: CreateUserOptions) { /* … */ }
Fix: Group related parameters into a config object or interface. This also makes call sites self-documenting.

Configuration

Override the threshold in tsmetrics.yaml:

thresholds: params: warning: 4 # flag at 4+ error: 7 # error at 7+
Edit on GitHub