Skip to main content

prefer-type-fest-or-all

Require TypeFest OrAll<TTuple> over SomeExtend<TTuple, true> boolean-tuple checks.

Targeted pattern scopeโ€‹

This rule targets direct and namespace-qualified references to SomeExtend<TTuple, true> imported from type-fest.

What this rule reportsโ€‹

  • SomeExtend<TTuple, true> when it is being used as a boolean-tuple disjunction check.

Why this rule existsโ€‹

OrAll is the dedicated TypeFest helper for checking whether any boolean tuple member is true. It is shorter, clearer, and matches the new canonical TypeFest naming.

โŒ Incorrectโ€‹

import type { SomeExtend } from "type-fest";

type AnyFlagsTrue = SomeExtend<[false, false, true], true>;

โœ… Correctโ€‹

import type { OrAll } from "type-fest";

type AnyFlagsTrue = OrAll<[false, false, true]>;

Behavior and migration notesโ€‹

  • This rule only targets SomeExtend<TTuple, true>.
  • It does not report SomeExtend<TTuple, SomeOtherType> usages.
  • Namespace-qualified type-fest references are reported too.

Additional examplesโ€‹

โŒ Incorrect โ€” Additional exampleโ€‹

import type * as TypeFest from "type-fest";

type Ready = TypeFest.SomeExtend<[false, false, true], true>;

โœ… Correct โ€” Additional exampleโ€‹

import type { OrAll } from "type-fest";

type Ready = OrAll<[false, false, true]>;

โœ… Correct โ€” Non-targeted usageโ€‹

import type { SomeExtend } from "type-fest";

type AnyStrings = SomeExtend<[1, "x", true], string>;

ESLint flat config exampleโ€‹

import typefest from "eslint-plugin-typefest";

export default [
{
plugins: { typefest },
rules: {
"typefest/prefer-type-fest-or-all": "error",
},
},
];

When not to use itโ€‹

Disable this rule if your codebase intentionally prefers the more general SomeExtend<TTuple, true> spelling for boolean tuple checks.

Package documentationโ€‹

TypeFest package documentation:

Source file: source/or-all.d.ts

/**
Returns a boolean for whether any of the given elements is `true`.

Use-cases:
- Check if at least one condition in a list of booleans is met.
*/
export type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;

Rule catalog ID: R080

Further readingโ€‹

Adoption resourcesโ€‹