title: How does typescript syntax let { var } = var work?
body: <p>I'm trying to learn how to use electron with Angular and got confused with syntax I saw from the Electrogram app.</p>
  
  <p>Link: <a href="https://github.com/onehungrymind/electrogram" rel="nofollow noreferrer">https://github.com/onehungrymind/electrogram</a></p>
  
  <p>In the <strong>app.ts</strong> file of electrogram's project, I saw the syntax:</p>
  
  <pre><code>import { remote, ipcRenderer } from 'electron';
  ...
  let {dialog} = remote;
  </code></pre>
  
  <p>I think it's referring to <code>dialog: Electron.Dialog;</code> in the projects <strong>index.d.ts</strong> at path <em>typings/globals/github-electron</em> although I really don't know yet how this is happening. (I'm also really new to typescript).</p>
  
  <p>If this was globally declared shouldn't it be at least <code>Electron.CommonElectron.dialog</code>?
   How can the compiler just know right away what we are referring to by just saying <code>let { dialog }</code>?</p>
  
  <p>Any explanation on this would be greatly appreciated as I really have no idea whats going on.</p>