diff --git a/src/runtime/cache.ts b/src/runtime/cache.ts index 514e3cd5a1..dc655016f3 100644 --- a/src/runtime/cache.ts +++ b/src/runtime/cache.ts @@ -195,11 +195,11 @@ export function defineCachedEventHandler< >( handler: EventHandler, opts?: CachedEventHandlerOptions -): EventHandler, Response>; +): EventHandler, Response>; // TODO: remove when appropriate // This signature provides backwards compatibility with previous signature where first generic was return type export function defineCachedEventHandler< - Request = Omit, + Request = Omit, Response = EventHandlerResponse, >( handler: EventHandler< diff --git a/test/fixture/types.ts b/test/fixture/types.ts index 0c5244284f..f0403b22d5 100644 --- a/test/fixture/types.ts +++ b/test/fixture/types.ts @@ -280,10 +280,15 @@ describe("defineCachedEventHandler", () => { >(); }); it("should not allow typed input body", () => { - const b = defineCachedEventHandler<{ body: string }, Promise<{ message: string }>>(fixture); - // eslint-disable-next-line @typescript-eslint/ban-types - expectTypeOf(b).toEqualTypeOf>>() - }) + const b = defineCachedEventHandler< + { body: string }, + Promise<{ message: string }> + >(fixture); + expectTypeOf(b).toEqualTypeOf< + // eslint-disable-next-line @typescript-eslint/ban-types + EventHandler<{}, Promise<{ message: string }>> + >(); + }); it("is backwards compatible with old generic signature", () => { const a = defineCachedEventHandler< Promise<{