new Hono<{ Bindings: Env }>();
seems incompatible with Cloudflare wrangler generated type Env
#3080
Answered
by
yusukebe
GregoryZeng
asked this question in
Q&A
-
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.
Answered by
yusukebe
Jul 2, 2024
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.
1 reply
Answer selected by
GregoryZeng
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @GregoryZeng
Below are my ideas.
interface
. Use atype
instead of it.