title: Typescript React types not recognised when compiling
body: <p>I'm trying to convert an application to React with typescript. I had it running correctly in plain ES2015. But now that I've added typescript to the picture, gulp throws errors when trying to compile my <code>.tsx</code> file:</p>
  
  <pre><code>error TS2339: Property 'setState' does not exist on type 'App'.
  </code></pre>
  
  <p>Even a stripped down test component fails with:</p>
  
  <pre><code>error TS2605: JSX element type 'App' is not a constructor function for JSX elements.
    Type 'App' is missing the following properties from type 'ElementClass': context, setState, forceUpdate, props, refs
  </code></pre>
  
  <pre><code>import * as React from "../libs/noinject/react.development";
  import * as ReactDOM from "../libs/noinject/react-dom.development";
  
  interface State {foo: string}
  export class App extends React.Component&lt;{}, State&gt; {
    state: State
    constructor(props: any) {
      super(props);
      this.state = {
        foo: 'bar',
      };
    }
    render() {
      return (
        &lt;div&gt;
          {this.state.foo}
        &lt;/div&gt;
      );
    }
  }
  
  document.addEventListener('DOMContentLoaded', function () {
    ReactDOM.render(&lt;App /&gt;, document.getElementById('app-root'));
  });
  </code></pre>
  
  <p>Clearly, the typescript compiler is not recognising the <code>React.Component</code> type. I am using <code>gulp-typescript</code> to compile, with the following compiler options:</p>
  
  <pre><code>{
      'lib': ['ES2018', 'DOM'],
      'target': 'es6',
      'module': 'none',
      'moduleResolution': 'node',
      'jsx': 'react',
      'types': [
        'react',
        'react-dom',
      ],
    }
  </code></pre>
  
  <p>node modules <code>@types/react</code> and <code>@types/react-dom</code> are installed and clearly being used, since removing them immediately causes the TS compilation step to fail complaining about the types not being found.</p>
  
  <p>Note that I also get the squiggly red underline in vscode intellisense with the same error (<code>Type 'App' is missing the following properties...</code>).</p>
  
  <p>What gives?</p>