Effect CommunityEC
Effect Community3y ago
61 replies
Joshua

Creating a Helper Function to Catch and Remove Specific Errors in TypeScript

I'm trying to write a helper function that catches a specific error and remove it from the propagated error type.

For example Effect<R, Error1 | Error2 | Error3, A>, And then

pipe(
  ...,
  Effect.catchTag('Error2', () => ....)
)


Which should result in Effect<R, Error1 | Error3, A>. Currently unable to specify the expected error type Error2 without loosing the ability to exclude it from the output type. How do I go about that?
Was this page helpful?