Skip to main content

typescript/prefer-array-type-alias

Prefer reusable alias names for array and tuple type aliases.

Targeted pattern scope

This rule targets type alias identifiers when the alias annotation is:

  • TSArrayType (T[]), or
  • TSTupleType ([A, B]).

The alias name must match a PascalCase pattern ending in Array or s.

What this rule reports

This rule reports array/tuple type aliases that do not follow preferred reusable alias naming.

Why this rule exists

Collection-shaped aliases become easier to recognize and search when naming is consistent.

❌ Incorrect

type Item = string[];

✅ Correct

type Items = string[];

Behavior and migration notes

This rule reports only and does not provide an autofix.

Migration is typically renaming the alias and updating references.

Options

This rule has no options.

Additional examples

type Pair = [string, string];
// ❌ reported

type Pairs = [string, string];
// ✅ valid

ESLint flat config example

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/typescript/prefer-array-type-alias": "error",
},
},
];

When not to use it

Disable this rule if your project does not standardize alias naming for array and tuple types.

Package documentation

Rule catalog ID: R103

Further reading

Adoption resources

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.