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:204

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

Runtime semantics: captures the key→predecessor mapping lazily. 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 Terminal and nested merges materialize inside core. A merge label applies to its materialized node. Reusing one merge preserves one output node.

Type Parameters

T

T extends Record<string, Stream<unknown>>

Parameters

streams

T

Returns

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