Globally extend the env
function return type with Zod schema type
#1737
Closed
jamiehaywood
started this conversation in
General
Replies: 1 comment 1 reply
-
So a follow up to this, which achieves what I want. You can pass the Hono constructor a generic to the const app = new Hono<{ Bindings: Env }>(); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is less of a Hono question, and more a TypeScript question, but I'm hoping someone can help me / tell me that this isn't possible.
Problem
I have a Zod schema:
I want to globally override the return type of the
env()
function, so that I don't need to pass in a generic every time I invokeenv()
, i.e:Attempted solution
I've tried globally extending the type in a
global.d.ts
, but I am having issues with the types playing nice:Any suggestions here would be greatly appreciated 🙏🏼
Beta Was this translation helpful? Give feedback.
All reactions