How to increase process.env in TypeScript?

process.envhas a type ProcessEnvwith this definition:

export interface ProcessEnv {
    [key: string]: string | undefined;
}

I would like to extend this TypeScript interface to contain keys specific to my application, so the result looks something like this:

export interface ProcessEnv {
    MY_VARIABLE_1: string;
    MY_OTHER_VARIABLE: string;
    [key: string]: string | undefined;
}

I can not find a way to do it, I think it will be declare module, or declare namespacesomewhere, but can not find a specific way of achieving this.

+4
source share

Source: https://habr.com/ru/post/1688382/


All Articles