xxxxxxxxxx
create environment.d.ts in root of project and paste follwing code.
declare global {
namespace NodeJS {
interface ProcessEnv {
/* NEXT_PUBLIC_SANITY_PROJECT: string;
NEXT_PUBLIC_SANITY_DATASET: string;
NEXT_PUBLIC_SANITY_API_VERSION: string; */
//Your env varaible declaration here.....
}
}
}
export {};
/*
The code you provided is similar to the previous example,
it is a TypeScript file that defines an interface for extending the
NodeJS.ProcessEnv interface.
It's adding three properties to the NodeJS.ProcessEnv interface
called NEXT_PUBLIC_SANITY_PROJECT,
NEXT_PUBLIC_SANITY_DATASET, and NEXT_PUBLIC_SANITY_API_VERSION..
This file is likely intended to be used as a global declaration file,
and is probably located in a folder such as @types or d.ts at the root of
the project.This means that TypeScript will include this file automatically
when you're compiling your code.
It could be used to access environment variables in a type-safe way, where
these environment variables are expected to be set by the developer or the
system administrator.
Also, the last line export {} is again a way of creating a new and empty
default export.It is done here to make sure that the interface is defined in a
module, so it can be imported in other files.
*/