Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 馃殌 : Add a new Env type that can be used and extended externally #1899

Open
dario-piotrowicz opened this issue Mar 26, 2024 · 1 comment
Assignees
Labels
feature request Request for Workers team to add a feature types Related to @cloudflare/workers-types

Comments

@dario-piotrowicz
Copy link
Member

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 the experimental entrypoint there)


This could be beneficial for uses of getPlatformProxy such as nitro-cloudflare-dev (see pi0/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 global Env 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 馃

@Aslemammad
Copy link

This would be huge for one of my projects! It adds much more flexibility and type-safety. Thank you so much y'all for tracking this.

@jasnell jasnell added the feature request Request for Workers team to add a feature label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for Workers team to add a feature types Related to @cloudflare/workers-types
Projects
Status: Untriaged
Development

No branches or pull requests

4 participants