prefer-type-fest-minimum-length-array
Prefer MinimumLengthArray from type-fest 6 for the following pattern.
Targeted pattern scopeโ
Mutable open tuples with at least two identical required elements followed by an array rest of the same type.
What this rule reportsโ
type Batch<T> = [T, T, ...T[]];
Why this rule existsโ
The count becomes the minimum length. Readonly, labeled, optional, and heterogeneous tuples carry information that the helper would lose.
โ Incorrectโ
type Batch<T> = [T, T, ...T[]];
โ Correctโ
import type { MinimumLengthArray } from "type-fest";
type Batch<T> = MinimumLengthArray<T, 2>;
Behavior and migration notesโ
The rule runs when the linted file resolves type-fest major version 6. It preserves the outer alias and its parameters. The fixer leaves comments in place and uses the configured import policy.
Package documentationโ
TypeFest package documentation:
Rule catalog ID: R145