"typescript": "3.7.2"

Our Requirements

We have an external html provide window.configs.

We may need to access window object in typescript to get config properties, and do some validation before initial network async request.

windowConfig.tsx :

interface iConfig extends Window {
  config: {
    username: string,
    server: string,
    port: number,

declare var window: iConfig;

export const windowConfig = window;

index.tsx :

import { windowConfig } from './windowConfig';

/* use windowConfig as 'window' */