-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make Array.separate
, Array.getRights
, Array.getLefts
, Array.getSomes
heterogeneous
#2744
Conversation
🦋 Changeset detectedLatest commit: 91bcf99 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified the signatures (#2823) and added a few dtslint tests (#2825).
I would extend the same support to:
- getRights
- getLefts
- getSomes
Additionally, I would add the following dtslint tests (also for the other 3) to showcase the new capabilities:
// $ExpectType [(string | Date)[], (number | boolean)[]]
Array.separate(hole<Iterable<Either.Either<number, string> | Either.Either<boolean, Date>>>())
// $ExpectType [(string | Date)[], (number | boolean)[]]
Array.separate(hole<Iterable<Either.Either<number, string>> | Iterable<Either.Either<boolean, Date>>>())
# Conflicts: # packages/effect/src/Array.ts
Array.separate
, Array.getRights
, Array.getLefts
, Array.getSomes
heterogeneous
packages/effect/src/Array.ts
Outdated
@@ -2254,7 +2254,14 @@ export const partitionMap: { | |||
* @category filtering | |||
* @since 2.0.0 | |||
*/ | |||
export const getSomes: <A>(self: Iterable<Option<A>>) => Array<A> = filterMap(identity) | |||
|
|||
export const getSomes: < |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work as well?
export const getSomes: <T extends Iterable<Option<X>>, X = any>(
self: T
) => Array<Option.Value<ReadonlyArray.Infer<T>>> = filterMap(identity as any)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
@KhraksMamtsov thanks! |
Type
Description
Related