Skip to main content

Function: merge()

merge<T>(streams): Stream<{ [K in string | number | symbol]: StreamOf<T[K]> }>

Defined in: packages/core/src/graph/stream.ts:169

merge({ a: sA, b: sB, c: sC }) produces a Stream<{ a: AOut; b: BOut; c: COut }>.

Runtime semantics: does NOT add a graph node; captures the key→ predecessor mapping into a MergeStream. The downstream .pipe() call bakes that mapping into its target node's mergeShape, which is what tells the runner to build { [label]: predOutput } as the step's input at execution time.

Constraints:

  • At least one stream required
  • All streams must originate from the same graph.from() call
  • Streams must be NodeStreams (not nested merges). Wrap an inner merge with .pipe(identity) first if you need to materialize it

Type Parameters

T

T extends Record<string, Stream<unknown>>

Parameters

streams

T

Returns

Stream<{ [K in string | number | symbol]: StreamOf<T[K]> }>