Skip to content

Add SomeExtend type#1380

Merged
sindresorhus merged 4 commits intomainfrom
feat/add-some-extend-type
Mar 15, 2026
Merged

Add SomeExtend type#1380
sindresorhus merged 4 commits intomainfrom
feat/add-some-extend-type

Conversation

@som-sm
Copy link
Collaborator

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

Adds SomeExtend type, similar to the AllExtend type.

Closes #1379.

@som-sm som-sm force-pushed the feat/add-some-extend-type branch from d5ec236 to 9bdb10b Compare March 14, 2026 15:42
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For SomeExtend, we can't directly return true if the target is any because SomeExtend<[], any> should return false. So, adjusted AllExtend's implementation as well so that it stays aligned with the implementation of SomeExtend.

// Optional elements
// If `exactOptionalPropertyTypes` were disabled, the target type would need an additional `| undefined` for a successful match.
// For example, `AllExtend<[1?, 2?], number>` would return `false`. To make it return `true`, the target type must be `number | undefined`.
// For example, `AllExtend<[1?, 2?], number>` would return `boolean`. To make it return `true`, the target type must be `number | undefined`.
Copy link
Collaborator Author

@som-sm som-sm Mar 14, 2026

Choose a reason for hiding this comment

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

Fixed typo.

@som-sm som-sm force-pushed the feat/add-some-extend-type branch from 9bdb10b to 7ca0747 Compare March 14, 2026 15:51
@som-sm som-sm force-pushed the feat/add-some-extend-type branch from 7ca0747 to be4fdcb Compare March 14, 2026 15:56
Repository owner deleted a comment from claude bot Mar 14, 2026
Repository owner deleted a comment from claude bot Mar 14, 2026
Repository owner deleted a comment from claude bot Mar 14, 2026
@som-sm som-sm marked this pull request as ready for review March 14, 2026 16:01
@som-sm som-sm requested a review from sindresorhus March 14, 2026 16:01
Repository owner deleted a comment from claude bot Mar 14, 2026
Repository owner deleted a comment from claude bot Mar 14, 2026
@sindresorhus sindresorhus merged commit bbce298 into main Mar 15, 2026
6 checks passed
@sindresorhus sindresorhus deleted the feat/add-some-extend-type branch March 15, 2026 14:40
@sindresorhus
Copy link
Owner

Looks great 👍

@som-sm som-sm mentioned this pull request Mar 15, 2026
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.

AtLeastOneExtend

2 participants