Better typing for $env/dynamic/*
#6202
Labels
breaking change
$env
Bugs related to the `$env` family of modules
low hanging fruit
types / typescript
Milestone
Describe the problem
When I put together the
$env/dynamic/*
modules, I made a stupid mistake thinking that we couldn't provide generated types similar to$env/static/*
. This resulted in the dynamic modules being typed like so:This forces users to explicitly type their data using the
App
types, which is annoying -- it's "fake" type safety -- nothing is guaranteeing those keys even exist on your env object.For some reason (maybe I was tired?) I didn't see the obvious solution...
Describe the proposed solution
This still allows for arbitrary optional dynamic variables (such as feature flags or environment-dependent settings), but removes the need to use "fake" types to provide autocomplete.
Alternatives considered
No response
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: