effect icon indicating copy to clipboard operation
effect copied to clipboard

`Stream.zip` for more than two streams

Open nounder opened this issue 6 months ago • 2 comments

What version of Effect is running?

3.6.0

What steps can reproduce the bug?

import { Effect, Stream } from "effect"

const stream = Stream.make(1, 2, 3).pipe(
	Stream.broadcast(3, 10),
	Stream.map(([s1, s2, s3]) => ({
		n1: s1,
		n2: s2.pipe(Stream.map((v) => v * 2)),
		n3: s2.pipe(Stream.map((v) => v * 3)),
	})),
	Stream.flatMap(({ n1, n2, n3 }) =>
		Stream.zip(n1, n2, n3), // TYPESCRIPT REPORTS: Expected 1-2 arguments, but got 3. ts (2554) [11, 22]
	),
)

Effect.runPromise(Stream.runCollect(stream)).then(console.log)

What is the expected behavior?

Passing more than 2 streams to Stream.zip works per documentation :

Zipping is a process of combining two or more streams to create a new stream by pairing elements from the input streams.

What do you see instead?

Expected 1-2 arguments, but got 3. ts (2554) [11, 22]

when passing more than 2 streams to Stream.zip

Additional information

No response

nounder avatar Aug 04 '24 23:08 nounder