title: Property does not exist on type Window & typeof globalThis
body: <p>In a Electron-React-Typescript app I'm getting this error:  <code>Property 'api' does not exist on type 'Window &amp; typeof globalThis'. window.api.send('open-type-A-window', '');</code></p>
  <p>But in a file index.d.ts  I declared interface Window in this way:</p>
  <pre><code>declare global {
    namespace NodeJS {
      declare interface Window {
        &quot;electron&quot;: {
            openNewWindow(): void;
        },
        &quot;api&quot;: {
            send: (channel, data) =&gt; {
                ipcRenderer.invoke(channel, data).catch(e =&gt; console.log(e))
            },
            receive: (channel, func) =&gt; {
              console.log(&quot;preload-receive called. args: &quot;);
              ipcRenderer.on(channel, (event, ...args) =&gt; func(...args));
            },
            electronIpcSendTo: (window_id: string, channel: string, ...arg: any) =&gt; {
              ipcRenderer.sendTo(window_id, channel, arg);
            },
            electronIpcSend: (channel: string, ...arg: any) =&gt; {
              ipcRenderer.send(channel, arg);
            },
            electronIpcSendSync: (channel: string, ...arg: any) =&gt; {
              return ipcRenderer.sendSync(channel, arg);
            },
            electronIpcOn: (channel: string, listener: (event: any, ...arg: any) =&gt; void) =&gt; {
              ipcRenderer.on(channel, listener);
            },
            electronIpcOnce: (channel: string, listener: (event: any, ...arg: any) =&gt; void) =&gt;
   {
              ipcRenderer.once(channel, listener);
            },
            electronIpcRemoveListener:  (channel: string, listener: (event: any, ...arg: any) 
  =&gt; void) =&gt; {
              ipcRenderer.removeListener(channel, listener);
            },
            electronIpcRemoveAllListeners: (channel: string) =&gt; {
              ipcRenderer.removeAllListeners(channel);
            }
        }
      }
    }
  }
  </code></pre>
  <p>I've read this thread: <a href="https://github.com/Microsoft/TypeScript/issues/19816" rel="noreferrer">https://github.com/Microsoft/TypeScript/issues/19816</a> but I didn't get the proper solution.</p>
  <p>What should I add / modify in order to avoid this error <code>Property 'api' does not exist on type 'Window &amp; typeof globalThis'</code>  ?</p>
  <ul>
  <li>node: v14.5.0</li>
  <li>electron: v11.2.3</li>
  <li>typescript: v4.1.3</li>
  <li>OS: Ubuntu 18.04.4 Desktop</li>
  </ul>