Effect CommunityEC
Effect Community3y ago
4 replies
Stephen Bluck

Type Errors with `Effect.if`

How does Effect.if work? I get type errors when doing this:
// Argument of type 'Effect<never, never, boolean>' is not assignable to parameter of type 'boolean'
export const test = Effect.if(Effect.succeed(true), {
  onTrue: () => Effect.succeed(1),
  onFalse: () => Effect.succeed(1)
});

Or this:
// Argument of type 'boolean' is not assignable to parameter of type 'Effect<unknown, unknown, boolean>'
export const test = Effect.if(true, {
  onTrue: () => Effect.succeed(1),
  onFalse: () => Effect.succeed(1)
});

But according to the types, these should be ok?
Was this page helpful?