title: TypeScript and d3 domain type
body: <p>I have a problem, when I want to use domain. </p>
  
  <p>So, I try to use next part of my code</p>
  
  <pre><code>var x = d3.time.scale()
    .domain([new Date('2016-06-10'), new Date('2016-06-25')])
    .rangeRound([0, 1000]);
  </code></pre>
  
  <p>And I get error about error types for domain...</p>
  
  <blockquote>
    <p>Argument of type 'Scale' is not assignable to parameter of type 'Scale'.</p>
    
    <p>Types of property 'domain' are incompatible.</p>
    
    <p>Type '{ (): Date[]; (dates: number[]): Scale; (dates: Date[]): Scale; }' is not assignable to type '{ (): number[]; (values: number[]): Scale; }'.</p>
    
    <p>Type 'Date[]' is not assignable to type 'number[]'.
    Type 'Date' is not assignable to type 'number'.</p>
  </blockquote>
  
  <p>But If we look d3 typings</p>
  
  <pre><code>domain(): Date[];
  domain(dates: number[]): Scale&lt;Range, Output&gt;;
  domain(dates: Date[]): Scale&lt;Range, Output&gt;;
  </code></pre>
  
  <p>domain can take Date array!</p>
  
  <p>If we disable types, then all works fine. </p>
  
  <p>And I have similar problem with another part of my code: </p>
  
  <pre><code>var drag = d3.behavior.drag()
    .on('drag', function (d) {
      d3.event.sourceEvent.stopPropagation();
    })
    .on('dragstart', function () {
      //
    });
  </code></pre>
  
  <p>I get error about:</p>
  
  <blockquote>
    <p>Property 'sourceEvent' does not exist on type 'Event | BaseEvent'.</p>
  </blockquote>
  
  <p>But If we look in types</p>
  
  <pre><code>export var event: Event | BaseEvent;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>interface BaseEvent {
       type: string;
       sourceEvent?: Event;
   }
  </code></pre>
  
  <p>I use typings:</p>
  
  <blockquote>
    <p>"d3": "registry:dt/d3#0.0.0+20160614091820"</p>
  </blockquote>
  
  <p>and awesome-typescript-loader for webpack</p>
  
  <p>So, what's wrong with me? </p>