I am now using a framework (vite) that injects environment variables into import.meta.env
.
I was previously able to create a file env.d.ts
to provide types to process.env
declare global {
namespace NodeJS {
interface ProcessEnv {
GITHUB_AUTH_TOKEN: string;
NODE_ENV: 'development' | 'production';
PORT?: string;
PWD: string;
}
}
}
I've tried the following but does not work.
declare global {
namespace NodeJS {
interface ImportMeta {
GITHUB_AUTH_TOKEN: string;
NODE_ENV: 'development' | 'production';
PORT?: string;
PWD: string;
}
}
}