new Hono<{ Bindings: Env }>();
seems incompatible with Cloudflare wrangler generated type Env
#3080
-
Hi, I am starting to use Hono with Cloudflare Workers.
where
The TypeScript type inference works fine after I manually replace Do you have any idea for this problem? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @GregoryZeng
Below are my ideas.
interface Env {
MY_VARIABLE: 'production_value'
MY_BUCKET: R2Bucket
MY_DB: D1Database
}
type Bindings = {
[key in keyof Env]: Env[key]
}
const app = new Hono<{ Bindings: Bindings }>() |
Beta Was this translation helpful? Give feedback.
Hi @GregoryZeng
Below are my ideas.
interface
. Use atype
instead of it.