Effect CommunityEC
Effect Community3y ago
4 replies
bsluther

Trouble with Streams in Node App

I'm running into a strange problem, I've been experimenting with Streams in a very simple node app, and now I'm trying to use them in a real project. I was having trouble recreating the same behavior, so eventually tried a very simple example:

const greetingStream = pipe(
  Effect.sync(() => 'Hello!'),
  Stream.repeatEffect,
  Stream.runDrain
)


In my real project, this gives me a compiler error at the Stream.repeatEffect:
Argument of type '<R, E, A>(effect: Effect<R, E, A>) => Stream<R, E, A>' is not assignable to parameter of type '(a: Effect<never, never, string>) => Stream<unknown, unknown, unknown>'.
  Types of parameters 'effect' and 'a' are incompatible.
    Type 'Effect<never, never, string>' is missing the following properties from type 'Effect<unknown, unknown, unknown>': [EffectTypeId], [SinkTypeId], [ChannelTypeId], [StreamTypeId]ts(2345)


And yet in the simple node app the same exact line compiles just fine.

Any idea what's happening?
Was this page helpful?