/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-generics-f8dc028c3a9c-generics-s0626-c0000.md

Generics - hono-docs

Generics Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt generics Summary You can pass Generics t...

Generics

Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#generics

Summary

You can pass Generics to specify the types of Cloudflare Workers Bindings and variables used in c.set/c.get. ```ts twoslash import { Hono } from 'hono' type User = any declare const user: User // ---cut--- type Bindings = { TOKEN: st...

Content

You can pass Generics to specify the types of Cloudflare Workers Bindings and variables used in c.set/c.get.

import { Hono } from 'hono'
type User = any
declare const user: User
// ---cut---
type Bindings = {
  TOKEN: string
}

type Variables = {
  user: User
}

const app = new Hono<{
  Bindings: Bindings
  Variables: Variables
}>()

app.use('/auth/*', async (c, next) => {
  const token = c.env.TOKEN // token is `string`
  // ...
  c.set('user', user) // user should be `User`
  await next()
})
Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-generics-f8dc028c3a9c-generics-s0626-c0000.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.