Skip to content

Add AndAll type#1383

Merged
sindresorhus merged 15 commits intomainfrom
feat/add-and-all-type
Mar 19, 2026
Merged

Add AndAll type#1383
sindresorhus merged 15 commits intomainfrom
feat/add-and-all-type

Conversation

@som-sm
Copy link
Collaborator

@som-sm som-sm commented Mar 18, 2026

Adds AndAll type.

expectType<AndAll<readonly boolean[]>>(boolean);

// Boundary cases
expectType<AndAll<[]>>(true);
Copy link
Collaborator Author

@som-sm som-sm Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AndAll, when instantiated with an empty array ([]), returns true, unlike OrAll, which returns false. This behavior is intentional/correct; see:

This is the same reason why Array.prototype.every returns true for empty arrays, while Array.prototype.some returns false.

@som-sm som-sm force-pushed the feat/add-and-all-type branch from cd3ce3f to ace9bfc Compare March 18, 2026 07:59
Repository owner deleted a comment from claude bot Mar 18, 2026
Repository owner deleted a comment from claude bot Mar 18, 2026
Repository owner deleted a comment from claude bot Mar 18, 2026
@som-sm som-sm marked this pull request as draft March 18, 2026 08:26
Repository owner deleted a comment from claude bot Mar 18, 2026
Repository owner deleted a comment from claude bot Mar 18, 2026
@som-sm som-sm marked this pull request as ready for review March 18, 2026 09:24
@som-sm som-sm requested a review from sindresorhus March 18, 2026 09:24
Repository owner deleted a comment from claude bot Mar 18, 2026
Repository owner deleted a comment from claude bot Mar 18, 2026
@som-sm som-sm marked this pull request as draft March 18, 2026 14:11
@som-sm som-sm marked this pull request as ready for review March 18, 2026 14:14
Repository owner deleted a comment from claude bot Mar 18, 2026
@sindresorhus sindresorhus merged commit 94aa3f8 into main Mar 19, 2026
6 checks passed
@sindresorhus sindresorhus deleted the feat/add-and-all-type branch March 19, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants