title: Dispatching custom events
body: <p>I have version 0.9.0.1 of the typescript compiler installed in my VS 2012 Update 3.</p>
  
  <p>I want to dispatch a custom event but the ambient variable declared in lib.d.ts does not expose the expected constructor signatures.</p>
  
  <p>When I use</p>
  
  <pre><code>var myEvent = new CustomEvent("my:event:type", { detail: { some: "data"} });
  window.dispatchEvent(myEvent);
  </code></pre>
  
  <p>the type script compiler complains, because according to him, only</p>
  
  <pre><code>var myEvent = new CustomEvent();
  </code></pre>
  
  <p>is correct.</p>
  
  <p>The latter is erroneous according to Chrome 27 and Aurora 24.02, due to "missing arguments"</p>
  
  <p>MDN also lists the actually-correct-but-not-for-typescript constructor signatures.</p>
  
  <p>My thinking was now to add the known-correct constructor signature to the ambient variable declaration, but without touching the shipped lib.d.ts file. Would this technically be possible? I could not come up with the correct syntax for it, and the language specification did not mention how to merge two such declarations.</p>
  
  <p>Alternatively, I simply edited lib.d.ts, which after a restart of the IDE provided me with the updated signature. Nevertheless, I'd rather not tamper with 3rd-party files in such a way.</p>
  
  <p>Last, is there some other mechanism I (sh|c)ould use to write type script code that dispatches a custom event?</p>
  
  <p>(Update: Restarting the IDE reloads lib.d.ts correctly. Also, corrected made-up event type name)</p>