fix: allow env generic with interfaces#28694
Merged
FGoessler merged 2 commits intoprisma:mainfrom Dec 3, 2025
Merged
Conversation
Contributor
Author
|
@FGoessler pls review this PR |
FGoessler
approved these changes
Dec 2, 2025
Contributor
FGoessler
left a comment
There was a problem hiding this comment.
Thanks for this tweak @SaubhagyaAnubhav 🎉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #28617
Problem
The
envhelper rejected interface-based environment variable types because the previous generic constraintEnv extends Record<string, string | undefined>required an index signature that interfaces don’t have.This caused
TS2344when following the documented example.Fix
The type definition of
envwas updated and a newEnvKeyhelper type was introduced to filter valid keys.This allows both interfaces and type aliases to work as expected without changing runtime behavior.
Changes Made
envsignature using a simplified generic patternEnvKeyto restrict keys tostring | undefinedvaluesResult