You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// env.d.tsimporttype{Env}from"@/env";declare global {namespaceNodeJS{interfaceProcessEnvextendsEnv{}}}
I get errors in:
Env: Type alias 'Env' circularly references itself.ts(2456)
env: 'env' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022);
The text was updated successfully, but these errors were encountered:
i dont think this is possible, as the error suggests it creates a circular reference.
what's the use case why you wanna do this? I believe augmenting process.env here is kinda scary since we have no assurance if the type iss correct then considering transforms, default values etc aren't taken into account then.
here env.DATABASE_URL will be guaranteed to be a string, but process.env.DATABASE_URL can be undefined. augmenting the type would potentailly cause a runtime error
Is there a way to augment
NodeJS.ProccessEnv
by extending theenv
object without rewriting them one by one.I've tried:
I get errors in:
Env
:Type alias 'Env' circularly references itself.ts(2456)
env
:'env' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)
;The text was updated successfully, but these errors were encountered: