Type Errors with Nested Excludes in TypeScript

I am getting some really frustrating type errors:
// This causes me compile time errors (there are no issues at runtime)
Effect.Effect<A, never, Exclude<Exclude<R, Foo>, Bar>>

// casting it to the following fixes all of the type errors
Effect.Effect<A, never, Exclude<R, Foo | Bar>>

Correct me if I am wrong but these are the same types just written differently? If so I am not sure why one is producing a type error and the other isn't. Is there a way to clean up those nested Exludes so it is no longer nested?
Was this page helpful?