Skip to content

Commit

Permalink
fix(types): broken test in future versions of typescript (#3310)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-shaka authored Aug 25, 2024
1 parent d1c7f6f commit 6d7565e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2249,15 +2249,18 @@ describe('Returning type from `app.use(path, mw)`', () => {
})
})
describe('generic typed variables', () => {
const okHelper = (c: Context) => {
return <TData>(data: TData) => c.json({ data })
}
type Variables = {
ok: <TData>(data: TData) => TypedResponse<{ data: TData }>
ok: ReturnType<typeof okHelper>
}
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) => {
Expand Down

0 comments on commit 6d7565e

Please sign in to comment.