TypeScript Union Type Issue with `Effect.catchAll` and `Effect.succeed`

One thing that is kind of annoying, but probably has nothing to do with Effect and is just classic TypeScript is if you catch an error using Effect.catchAll or Effect.catchTags and you handle that error by calling Effect.succeed with the exact same return type as the actual logic, TypeScript will type the response as a union instead of a singular type.

Example:
  /* Returned Effect Type Parameters */
type Success = { success: boolean; message: string; } | { success: boolean; message: string; }
Was this page helpful?