title: declaring a property in constructor with typescript react
body: <p>From the draft-js documention, one can (in vanilla React, with no typescript) setup the Draft-js environment thus, noticing that the <code>onChange</code> property can be declared directly in the constructor: </p>
  
  <pre><code>import React from 'react';
  import ReactDOM from 'react-dom';
  import {Editor, EditorState} from 'draft-js';
  
  class MyEditor extends React.Component {
    constructor(props) {
      super(props);
      this.state = {editorState: EditorState.createEmpty()};
      this.onChange = (editorState) =&gt; this.setState({editorState});
    }
    render() {
      const {editorState} = this.state;
      return &lt;Editor editorState={editorState} onChange={this.onChange} /&gt;;
    }
  }
  </code></pre>
  
  <p>However, when I try to do the same with Typescript/React (code below), I get this error</p>
  
  <p>error TS2339: Property 'onChange' does not exist on type 'Main'.</p>
  
  <pre><code>class Main extends React.Component&lt;MainProps, MainState&gt; {
  
      constructor(props) {
      super(props);
      this.state = { todos: [], editorState: EditorState.createEmpty() };
      this.onChange = (editorState) =&gt; this.setState({ editorState });
    }
  </code></pre>
  
  <p>I also tried adding <code>onChange</code> as a property to the props</p>
  
  <pre><code>interface MainProps {
      model: Model;
      onChange: Function;
  }
  </code></pre>
  
  <p>What is the appropriate way to declare such a function property in typescript/react?</p>