<A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>
readonly concurrency?: number | "unbounded" | undefined
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
<A, E, R, X, E2, R2, Y, E3, R3>(
self: Stream<A, E, R>,
options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>
readonly concurrency?: number | "unbounded" | undefined
}
): Stream<A, E | E2 | E3, R | R2 | R3>Returns a stream that effectfully "peeks" at elements and failures.
Example (Tapping values and errors)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
const stream = Stream.make(1, 2).pipe(
Stream.concat(Stream.fail("boom")),
Stream.tapBoth({
onElement: (value) => Console.log(`seen: ${value}`),
onError: (error) => Console.log(`error: ${error}`)
}),
Stream.catch(() => Stream.make(3))
)
const result = yield* Stream.runCollect(stream)
yield* Console.log(result)
})
Effect.runPromise(program)
// Output:
// seen: 1
// seen: 2
// error: boom
// [ 1, 2, 3 ]export const const tapBoth: {
<A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
readonly concurrency?:
| number
| "unbounded"
| undefined
}): <R>(
self: Stream<A, E, R>
) => Stream<A, E | E2 | E3, R | R2 | R3>
<A, E, R, X, E2, R2, Y, E3, R3>(
self: Stream<A, E, R>,
options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
readonly concurrency?:
| number
| "unbounded"
| undefined
}
): Stream<A, E | E2 | E3, R | R2 | R3>
}
Returns a stream that effectfully "peeks" at elements and failures.
Example (Tapping values and errors)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
const stream = Stream.make(1, 2).pipe(
Stream.concat(Stream.fail("boom")),
Stream.tapBoth({
onElement: (value) => Console.log(`seen: ${value}`),
onError: (error) => Console.log(`error: ${error}`)
}),
Stream.catch(() => Stream.make(3))
)
const result = yield* Stream.runCollect(stream)
yield* Console.log(result)
})
Effect.runPromise(program)
// Output:
// seen: 1
// seen: 2
// error: boom
// [ 1, 2, 3 ]
tapBoth: {
<function (type parameter) A in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
A, function (type parameter) E in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E, function (type parameter) X in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
X, function (type parameter) E2 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E2, function (type parameter) R2 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
R2, function (type parameter) Y in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
Y, function (type parameter) E3 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E3, function (type parameter) R3 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
R3>(
options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
readonly concurrency?:
| number
| "unbounded"
| undefined
}
options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
onElement: (a: NoInfer<A>a: type NoInfer<A> = [A][A extends any ? 0 : never]Prevents TypeScript from inferring a type parameter from a specific
position.
When to use
Use when a function parameter must match an inferred type without becoming
an inference source.
Details
The parameter using NoInfer must still match the inferred type.
Example (Controlling inference)
import type { Types } from "effect"
declare function withDefault<T>(value: T, fallback: Types.NoInfer<T>): T
// T is inferred as "a" | "b" from the first argument only
const result = withDefault<"a" | "b">("a", "b")
NoInfer<function (type parameter) A in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
A>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<function (type parameter) X in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
X, function (type parameter) E2 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E2, function (type parameter) R2 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
onError: (a: NoInfer<E>a: type NoInfer<A> = [A][A extends any ? 0 : never]Prevents TypeScript from inferring a type parameter from a specific
position.
When to use
Use when a function parameter must match an inferred type without becoming
an inference source.
Details
The parameter using NoInfer must still match the inferred type.
Example (Controlling inference)
import type { Types } from "effect"
declare function withDefault<T>(value: T, fallback: Types.NoInfer<T>): T
// T is inferred as "a" | "b" from the first argument only
const result = withDefault<"a" | "b">("a", "b")
NoInfer<function (type parameter) E in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<function (type parameter) Y in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
Y, function (type parameter) E3 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E3, function (type parameter) R3 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
R3>
readonly concurrency?: number | "unbounded" | undefinedconcurrency?: number | "unbounded" | undefined
}
): <function (type parameter) R in <R>(self: Stream<A, E, R>): Stream<A, E | E2 | E3, R | R2 | R3>R>(self: Stream<A, E, R>(parameter) self: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self: interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) A in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
A, function (type parameter) E in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E, function (type parameter) R in <R>(self: Stream<A, E, R>): Stream<A, E | E2 | E3, R | R2 | R3>R>) => interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) A in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
A, function (type parameter) E in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E | function (type parameter) E2 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E2 | function (type parameter) E3 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
E3, function (type parameter) R in <R>(self: Stream<A, E, R>): Stream<A, E | E2 | E3, R | R2 | R3>R | function (type parameter) R2 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
R2 | function (type parameter) R3 in <A, E, X, E2, R2, Y, E3, R3>(options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): <R>(self: Stream<A, E, R>) => Stream<A, E | E2 | E3, R | R2 | R3>
R3>
<function (type parameter) A in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
A, function (type parameter) E in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E, function (type parameter) R in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R, function (type parameter) X in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
X, function (type parameter) E2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E2, function (type parameter) R2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R2, function (type parameter) Y in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
Y, function (type parameter) E3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E3, function (type parameter) R3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R3>(
self: Stream<A, E, R>(parameter) self: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self: interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) A in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
A, function (type parameter) E in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E, function (type parameter) R in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R>,
options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
readonly concurrency?:
| number
| "unbounded"
| undefined
}
options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
onElement: (a: NoInfer<A>a: type NoInfer<A> = [A][A extends any ? 0 : never]Prevents TypeScript from inferring a type parameter from a specific
position.
When to use
Use when a function parameter must match an inferred type without becoming
an inference source.
Details
The parameter using NoInfer must still match the inferred type.
Example (Controlling inference)
import type { Types } from "effect"
declare function withDefault<T>(value: T, fallback: Types.NoInfer<T>): T
// T is inferred as "a" | "b" from the first argument only
const result = withDefault<"a" | "b">("a", "b")
NoInfer<function (type parameter) A in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
A>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<function (type parameter) X in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
X, function (type parameter) E2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E2, function (type parameter) R2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
onError: (a: NoInfer<E>a: type NoInfer<A> = [A][A extends any ? 0 : never]Prevents TypeScript from inferring a type parameter from a specific
position.
When to use
Use when a function parameter must match an inferred type without becoming
an inference source.
Details
The parameter using NoInfer must still match the inferred type.
Example (Controlling inference)
import type { Types } from "effect"
declare function withDefault<T>(value: T, fallback: Types.NoInfer<T>): T
// T is inferred as "a" | "b" from the first argument only
const result = withDefault<"a" | "b">("a", "b")
NoInfer<function (type parameter) E in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<function (type parameter) Y in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
Y, function (type parameter) E3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E3, function (type parameter) R3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R3>
readonly concurrency?: number | "unbounded" | undefinedconcurrency?: number | "unbounded" | undefined
}
): interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) A in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
A, function (type parameter) E in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E | function (type parameter) E2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E2 | function (type parameter) E3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E3, function (type parameter) R in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R | function (type parameter) R2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R2 | function (type parameter) R3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R3>
} = import dualdual(2, <function (type parameter) A in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
A, function (type parameter) E in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E, function (type parameter) R in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R, function (type parameter) X in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
X, function (type parameter) E2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E2, function (type parameter) R2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R2, function (type parameter) Y in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
Y, function (type parameter) E3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E3, function (type parameter) R3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R3>(
self: Stream<A, E, R>(parameter) self: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self: interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) A in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
A, function (type parameter) E in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E, function (type parameter) R in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R>,
options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
readonly concurrency?:
| number
| "unbounded"
| undefined
}
options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
onElement: (a: NoInfer<A>a: type NoInfer<A> = [A][A extends any ? 0 : never]Prevents TypeScript from inferring a type parameter from a specific
position.
When to use
Use when a function parameter must match an inferred type without becoming
an inference source.
Details
The parameter using NoInfer must still match the inferred type.
Example (Controlling inference)
import type { Types } from "effect"
declare function withDefault<T>(value: T, fallback: Types.NoInfer<T>): T
// T is inferred as "a" | "b" from the first argument only
const result = withDefault<"a" | "b">("a", "b")
NoInfer<function (type parameter) A in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
A>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<function (type parameter) X in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
X, function (type parameter) E2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E2, function (type parameter) R2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
onError: (a: NoInfer<E>a: type NoInfer<A> = [A][A extends any ? 0 : never]Prevents TypeScript from inferring a type parameter from a specific
position.
When to use
Use when a function parameter must match an inferred type without becoming
an inference source.
Details
The parameter using NoInfer must still match the inferred type.
Example (Controlling inference)
import type { Types } from "effect"
declare function withDefault<T>(value: T, fallback: Types.NoInfer<T>): T
// T is inferred as "a" | "b" from the first argument only
const result = withDefault<"a" | "b">("a", "b")
NoInfer<function (type parameter) E in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<function (type parameter) Y in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
Y, function (type parameter) E3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E3, function (type parameter) R3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R3>
readonly concurrency?: number | "unbounded" | undefinedconcurrency?: number | "unbounded" | undefined
}
): interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) A in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
A, function (type parameter) E in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E | function (type parameter) E2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E2 | function (type parameter) E3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
E3, function (type parameter) R in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R | function (type parameter) R2 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R2 | function (type parameter) R3 in <A, E, R, X, E2, R2, Y, E3, R3>(self: Stream<A, E, R>, options: {
readonly onElement: (a: NoInfer<A>) => Effect.Effect<X, E2, R2>;
readonly onError: (a: NoInfer<E>) => Effect.Effect<Y, E3, R3>;
readonly concurrency?: number | "unbounded" | undefined;
}): Stream<A, E | E2 | E3, R | R2 | R3>
R3> =>
self: Stream<A, E, R>(parameter) self: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self.pipe(
const tapError: {
<E, A2, E2, R2>(
f: (error: E) => Effect.Effect<A2, E2, R2>
): <A, R>(
self: Stream<A, E, R>
) => Stream<A, E | E2, R2 | R>
<A, E, R, A2, E2, R2>(
self: Stream<A, E, R>,
f: (error: E) => Effect.Effect<A2, E2, R2>
): Stream<A, E | E2, R | R2>
}
tapError(options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
readonly concurrency?:
| number
| "unbounded"
| undefined
}
options.onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
onError),
const tap: {
<A, X, E2, R2>(
f: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>,
options?:
| {
readonly concurrency?:
| number
| "unbounded"
| undefined
}
| undefined
): <E, R>(
self: Stream<A, E, R>
) => Stream<A, E2 | E, R2 | R>
<A, E, R, X, E2, R2>(
self: Stream<A, E, R>,
f: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>,
options?:
| {
readonly concurrency?:
| number
| "unbounded"
| undefined
}
| undefined
): Stream<A, E | E2, R | R2>
}
tap(options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
readonly concurrency?:
| number
| "unbounded"
| undefined
}
options.onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
onElement, { concurrency?: number | "unbounded" | undefinedconcurrency: options: {
readonly onElement: (
a: NoInfer<A>
) => Effect.Effect<X, E2, R2>
readonly onError: (
a: NoInfer<E>
) => Effect.Effect<Y, E3, R3>
readonly concurrency?:
| number
| "unbounded"
| undefined
}
options.concurrency?: number | "unbounded" | undefinedconcurrency })
))