Matching Implementation to Interface in TypeScript
How can I make this implementation match the desired interface?
The inferred type is:
export class EventService extends Effect.Tag("@boda/event-service")<
EventService,
{
publish(payload: event.Notification): Effect.Effect<void, never>;
}
>() {
static Live = EventService.of({
publish(payload) {
return Effect.tryPromise({
try: () => {
return db
.insertInto("events")
.values(event.encode(payload))
.execute();
},
catch: (error) =>
Effect.gen(function* (_) {
yield* Effect.logError("Error publishing event", error);
yield* Effect.succeedNone;
}),
}).pipe(Effect.asVoid, Effect.withLogSpan("EventService.publish"));
},
});
}export class EventService extends Effect.Tag("@boda/event-service")<
EventService,
{
publish(payload: event.Notification): Effect.Effect<void, never>;
}
>() {
static Live = EventService.of({
publish(payload) {
return Effect.tryPromise({
try: () => {
return db
.insertInto("events")
.values(event.encode(payload))
.execute();
},
catch: (error) =>
Effect.gen(function* (_) {
yield* Effect.logError("Error publishing event", error);
yield* Effect.succeedNone;
}),
}).pipe(Effect.asVoid, Effect.withLogSpan("EventService.publish"));
},
});
}The inferred type is:
Effect<void, Effect<void, never, never>, never>Effect<void, Effect<void, never, never>, never>