How to access a global variable inside a module in TypeScript?
Hello everyone! I'm new to TypeScript and ran into a problem when transitioning from regular JavaScript to a module system.
I have a project where I use a global variable `window.myApp` declared in a separate script (e.g., in `config.js`), which is loaded before my main module:
```typescript
// config.js (loaded before modules)
window.myApp = {
apiBaseUrl: 'https://api.example.com',
debugMode: true
};
```
In my TypeScript file, I'm trying to access this global variable, but TypeScript throws an error:
```typescript
// main.ts
import { fetchData } from './api';
const config = window.myApp; // Error: Property 'myApp' does not exist on type 'Window'
console.log(config.apiBaseUrl);
```
I understand that TypeScript is strictly typed