title: React PropTypes throwing instanceof error for class extended with Typescript definitions
body: <p>I'm running into a problem writing Typescript definitions for a third-party script that's using React PropTypes's instanceof check. Specifically <a href="http://software.es.net/react-timeseries-charts/" rel="nofollow noreferrer">React TimeSeries Charts</a> and <a href="http://software.es.net/pond/" rel="nofollow noreferrer">PondJS</a>. (They don't have any created yet, which is why I'm under-taking it).</p>
  
  <p>I've defined a Type file for Pond that looks like this</p>
  
  <pre><code>declare module 'pondjs' {
  
    type Timestamp = number;
    /* other type aliases */
  
    export class TimeSeries {
      constructor(
        options: {
          [index: string]: any;
        }
      );
      static is: (arg1: TimeSeries, arg2: TimeSeries) =&gt; boolean;
      range: () =&gt; any;
      min: (key: string) =&gt; number;
      max: (key: string) =&gt; number;
      name: () =&gt; any;
      atTime: (timestamp: Timestamp) =&gt; any;
      /* Other methods */
    }
  
    /* Other Class Definitions */
  }
  </code></pre>
  
  <p>This is then used by my wrapper class something like this</p>
  
  <pre><code>import { TimeSeries } from 'pondjs';
  import { ChartContainer, ChartRow, LineChart } from 'react-timeseries-charts';
  
  const timeSeries: TimeSeries = new TimeSeries({events: [{value: 15}]});
  
  class myWrapper extends React.Component&lt;Props, {}&gt; {
    render() {
      return (
        &lt;ChartContainer&gt;
          &lt;ChartRow&gt;
            &lt;LineChart series={timeSeries} /&gt;
          &lt;/ChartRow&gt;
        &lt;/ChartContainer&gt;
      );
  }
  </code></pre>
  
  <p><strong>This is an extremely reduced example, but my real code all works correctly, draws the correct thing to the page, and Typescript fails to compile if I pass incorrect parameters.</strong></p>
  
  <p>However, I'm getting a bunch of errors from PropTypes thrown from <a href="https://github.com/facebook/prop-types/blob/master/factoryWithTypeCheckers.js#L264" rel="nofollow noreferrer">PropType's <code>createInstanceTypeChecker</code></a>.</p>
  
  <pre><code>"Warning: Failed prop type: Invalid prop `series` of type `TimeSeries` supplied to `LineChart`, expected instance of `TimeSeries`." 
  </code></pre>
  
  <p>The problem is that <code>LineChart</code> checks <a href="https://github.com/esnet/react-timeseries-charts/blob/master/src/components/LineChart.js#L267" rel="nofollow noreferrer"><code>series: propTypes.instanceof(TimeSeries)</code></a>, but it's of course internally importing Pond and checking against the "real" <code>TimeSeries</code>, not the one that has come through my Typescript type module definition.</p>
  
  <p>When I step inside createInstanceTypeChecker to see what's going on, I can see that even though they're technically not the same class, (so I guess PropTypes is justified in its error) they <em>are</em> the same for all practical purposes, which is what I would expect Typescript to have produced.</p>
  
  <pre><code>&gt; expectedClass === props[propName].constructor
  false
  &gt; props[propName] instanceof expectedClass
  false
  &gt; props[propName].constructor
  ƒ TimeSeries(arg) {
          (0, _classCallCheck3.default)(this, TimeSeries);
  
          this._collection = null;
          // Collection
          this._data = null;
  
          // Meta data
          if (arg ins…
  
  &gt; expectedClass
  ƒ TimeSeries(arg) {
          (0, _classCallCheck3.default)(this, TimeSeries);
  
          this._collection = null;
          // Collection
          this._data = null;
  
          // Meta data
          if (arg ins…
  </code></pre>
  
  <p>However, I would still expect that instanceof check to be true if Typescript is doing what I thought it did, something like the following</p>
  
  <pre><code>import { TimeSeries as _ts } from 'pondjs';
  export class TimeSeries extends _ts {
      /* same class, but with type extensions */
  }
  </code></pre>
  
  <p>I suppose React TimeSeries Charts could "solve" by checking the shape of the prop instead of the specific constructor used. However, this must also be a very common issue when adding type definitions for third party libs, right? Since I can't find similar bug reports anywhere, I suspect I must be missing something obvious.</p>
  
  <p>I don't want to disable PropTypes completely. I'd either like to find out I'm misconfiguring this type declaration file and change it so PropTypes checking instanceof works, or be able to update React TimeSeries Charts with a different equally simple check that PropTypes could do to convince itself the Typescript-enhanced classes are still essentially the same class, without resorting to comparing the shape key by key.</p>
  
  <p>Versions:</p>
  
  <ul>
  <li>Typescript 2.5.0</li>
  <li>React 15.6.1</li>
  <li>Proptypes 15.5.10</li>
  <li>PondJS 0.8.7</li>
  <li>React TimeSeries Charts 0.12.8</li>
  </ul>