Type error when using effect-http with Api and RouterBuilder
Does anyone know why I get this type error when using effect-http and setting multiple responses:
const api = Api.make().pipe(
Api.addEndpoint(
Api.get("health", "/health", { description: "Health check endpoint" }).pipe(
Api.setResponseStatus(200),
),
),
Api.addEndpoint(
Api.get("getTap", "/v1/taps/:id", { description: "Get a tap by id" }).pipe(
Api.setRequestPath(S.Struct({ id: Tap.Id })),
Api.setResponseBody(S.String),
Api.addResponse(ApiResponse.make(200, S.String)),
Api.addResponse(ApiResponse.make(404, S.String)),
),
),
)
const app = RouterBuilder.make(api).pipe(
RouterBuilder.handle("health", () => Effect.void),
RouterBuilder.handle("getTap", ({ path }) =>
// Type 'Effect<{ status: 404; body: string; }, never, never>' is not assignable to type 'Effect<string, never, never>'.
// Type '{ status: 404; body: string; }' is not assignable to type 'string'.
Effect.succeed({ status: 404 as const, body: "not found" }),
),
RouterBuilder.build,
)const api = Api.make().pipe(
Api.addEndpoint(
Api.get("health", "/health", { description: "Health check endpoint" }).pipe(
Api.setResponseStatus(200),
),
),
Api.addEndpoint(
Api.get("getTap", "/v1/taps/:id", { description: "Get a tap by id" }).pipe(
Api.setRequestPath(S.Struct({ id: Tap.Id })),
Api.setResponseBody(S.String),
Api.addResponse(ApiResponse.make(200, S.String)),
Api.addResponse(ApiResponse.make(404, S.String)),
),
),
)
const app = RouterBuilder.make(api).pipe(
RouterBuilder.handle("health", () => Effect.void),
RouterBuilder.handle("getTap", ({ path }) =>
// Type 'Effect<{ status: 404; body: string; }, never, never>' is not assignable to type 'Effect<string, never, never>'.
// Type '{ status: 404; body: string; }' is not assignable to type 'string'.
Effect.succeed({ status: 404 as const, body: "not found" }),
),
RouterBuilder.build,
)