How to Restrict Type `E` to Extend `Data.TaggedError` in a Generic Function

Hello guys! A quick question: All errors in my apps are done in the following way
class SomeError extends Data.TaggedError("SomeError")<{ some props... }> {}

I need to write a generic function that accepts and effect with this kind of errors, example:
const someFn = <A, E, R>(self: Effect.Effect<A, E, R>) => self.pipe(
  Effect.tapError((error) => Console.log(error._tag)) // <- this is just a simple example
)

How can I making the type E extends a Data.TaggedError?
Was this page helpful?