I was following the steps which are mentioned in the section usage with typescript but it was not working there and throwing error "Property does not exist on type Window in TypeScript" but i found solution to this problem for future users if by chance they would face the same situation..
SOLUTION for problem "Property does not exist on type Window in TypeScript"
STEP:1 In your src directory, create a types directory that contains the following index.d.ts file: src/types/index.d.ts
I was following the steps which are mentioned in the section usage with typescript but it was not working there and throwing error "Property does not exist on type Window in TypeScript" but i found solution to this problem for future users if by chance they would face the same situation..
SOLUTION for problem "Property does not exist on type Window in TypeScript"
STEP:1 In your src directory, create a types directory that contains the following index.d.ts file: src/types/index.d.ts
export {};
declare global { interface Window { __RUNTIME_CONFIG__: { NODE_ENV: string; REACT_APP_API_URL: string; }; } }
STEP: 2 add the path to your types directory to your tsconfig.json file.
tsconfig.json
{ "compilerOptions": { // ... rest "typeRoots": ["./node_modules/@types", "./src/types"] } } STEP: 3 Now use it, whereever you want to do it.
{window.__RUNTIME_CONFIG__.NODE_ENV}