Feature 🚀 : Add a new Env
type that can be used and extended externally
#1899
Labels
feature request
Request for Workers team to add a feature
types
Related to @cloudflare/workers-types
Adding a new
Env
type in the workers-types package could be beneficial as it could be used/leveraged by users and library/framework authors.I made this simple POC regarding this: https://github.com/dario-piotrowicz/workers-types-env-poc
(in the POC's
workers-types
's node_modules directory you can see the type of change I have in mind, only applied to theexperimental
entrypoint there)This could be beneficial for uses of
getPlatformProxy
such as nitro-cloudflare-dev (see nitrojs/nitro-cloudflare-dev#13)(cc. @pi0, @Aslemammad)
We've been also asked about this from the Remix team once. Their reasoning there being that having an
Env
interface somewhere, always guaranteed to exist, allows for libraries to be written with more stable/robust typing instead of having to reply on a globalEnv
interface that might or not exist, @pcattori please feel free to add context here regarding this if you want 🙂.This needs a bit of discussion though as the introduction of such a type, although not complex would likely not be trivial and the effort of implementing and maintaining such type could outweigh the benefits 🤔
The text was updated successfully, but these errors were encountered: