Simplifying `Effect.catchTag` with inferred generics for reusable helper

I want to extract repetitive Effect.catchTag calls into a reusable helper, and noticed I need a ton of explicit generic types. Is it possible to infer some of those or to simplify the expression?
export const mapDatabaseError = (operation?: string) =>
    Effect.catchTag<SqlError.SqlError, ['SqlError'], never, DatabaseError, never>('SqlError', (cause) =>
        Effect.fail(new DatabaseError({ cause, operation })),
    )

I pretty much want to .pipe(mapDatabaseError()) for any Drizzle operation instead of manually typing it out.
Was this page helpful?