From 6d7565e2a121a43a8a9e8e9d20768231e7b46764 Mon Sep 17 00:00:00 2001 From: m-shaka Date: Sun, 25 Aug 2024 15:55:37 +0900 Subject: [PATCH] fix(types): broken test in future versions of typescript (#3310) --- src/types.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/types.test.ts b/src/types.test.ts index bdb1ef27..0eddce9e 100644 --- a/src/types.test.ts +++ b/src/types.test.ts @@ -2249,15 +2249,18 @@ describe('Returning type from `app.use(path, mw)`', () => { }) }) describe('generic typed variables', () => { + const okHelper = (c: Context) => { + return (data: TData) => c.json({ data }) + } type Variables = { - ok: (data: TData) => TypedResponse<{ data: TData }> + ok: ReturnType } const app = new Hono<{ Variables: Variables }>() it('Should set and get variables with correct types', async () => { const route = app .use('*', async (c, next) => { - c.set('ok', (data) => c.json({ data })) + c.set('ok', okHelper(c)) await next() }) .get('/', (c) => {