Implementing a Delayed Stream with Effect in TypeScript

Is there a Stream.delay function? I created one, but it would be better if I could use something included in Effect
const delayedStream = <A, E, R>(stream: Stream.Stream<A, E, R>, duration: DurationInput) =>
  Stream.Do.pipe(
    Stream.mapEffect(() => Effect.delay(Effect.sync(() => stream), duration)),
    (_) => Stream.flatten(_)
  );
Was this page helpful?