How to augment process.env in TypeScript?
The ProcessEnv
must be inside the namespace NodeJS
and doesn't need to declare the [key: string]: string | undefined;
, it inherits from the initial ProccessEnv
.
declare namespace NodeJS {
export interface ProcessEnv {
MY_VARIABLE_1: string;
MY_OTHER_VARIABLE: string;
}
}