Skip to content

Commit

Permalink
fix: Effect.forEach overload (#2640)
Browse files Browse the repository at this point in the history
  • Loading branch information
patroza committed Apr 27, 2024
1 parent 69d974b commit 661004f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-wolves-sip.md
@@ -0,0 +1,5 @@
---
"effect": patch
---

fix: forEach NonEmpty overload causing inference issues for Iterables
2 changes: 1 addition & 1 deletion packages/effect/dtslint/Effect.ts
Expand Up @@ -62,7 +62,7 @@ pipe(
// -------------------------------------------------------------------------------------

// $ExpectType Effect<[string, ...string[]], "err-1", "dep-1">
Effect.forEach(["a", "b"], (
Effect.forEach(["a", "b"] as NonEmptyReadonlyArray<string>, (
// $ExpectType string
_a,
// $ExpectType number
Expand Down
17 changes: 4 additions & 13 deletions packages/effect/src/Effect.ts
Expand Up @@ -673,24 +673,15 @@ export const forEach: {
readonly discard: true
}
): (self: Iterable<A>) => Effect<void, E, R>
<A, B, E, R>(
self: RA.NonEmptyReadonlyArray<A>,
f: (a: A, i: number) => Effect<B, E, R>,
options?: {
readonly concurrency?: Concurrency | undefined
readonly batching?: boolean | "inherit" | undefined
readonly discard?: false | undefined
} | undefined
): Effect<RA.NonEmptyArray<B>, E, R>
<A, B, E, R>(
self: Iterable<A>,
f: (a: A, i: number) => Effect<B, E, R>,
<B, E, R, S extends Iterable<any>>(
self: S,
f: (a: RA.ReadonlyArray.Infer<S>, i: number) => Effect<B, E, R>,
options?: {
readonly concurrency?: Concurrency | undefined
readonly batching?: boolean | "inherit" | undefined
readonly discard?: false | undefined
} | undefined
): Effect<Array<B>, E, R>
): Effect<RA.ReadonlyArray.With<S, B>, E, R>
<A, B, E, R>(
self: Iterable<A>,
f: (a: A, i: number) => Effect<B, E, R>,
Expand Down

0 comments on commit 661004f

Please sign in to comment.