Skip to content

Too Many Parameters (ARCH3181)

Key typescript.quality.too-many-parameters · Severity warning · Category quality

Functions with many parameters are easy to misorder at the call site and hard to read. Related parameters should be grouped into a parameter object, or dependencies injected.

function createUser(
name: string, email: string, age: number,
country: string, city: string, zip: string,
isAdmin: boolean, newsletter: boolean
) {
// ...
}
interface CreateUserInput {
name: string; email: string; age: number;
address: { country: string; city: string; zip: string };
isAdmin: boolean; newsletter: boolean;
}
function createUser(input: CreateUserInput) {
// ...
}

Group related parameters into a single parameter (options) object.