title: React Higher Order Component (HOC) in typescript
body: <p>I am trying to write a React HOC in typescript but I am not getting the definitions correct. I am not sure if what I am trying to accomplish is possible.</p>
  
  <p>Here is my code</p>
  
  <pre><code>import * as React from 'react'
  
  export default function Ajax&lt;Props, State&gt;(InnerComponent: typeof React.Component): React.ComponentClass&lt;Props &amp; State&gt; {
    return class extends InnerComponent&lt;Props &amp; State,any&gt; {
      constructor() {
        super()
        this.state = {
          request: 'initial'
        }
      }
      changeRequest(newRequest) {
        this.setState({request: 'loading'})
      }
      render() {
        return &lt;InnerComponent 
          {...this.props } 
          {...this.state}
          changeRequest={this.changeRequest} 
        /&gt;
      }
    }
  }
  </code></pre>
  
  <p>If i am just passing the props and state to the child it works. But how can I write the definitions to be able to pass additional props to the wrapped component? In this case the changeRequest prop.</p>
  
  <p>Thanks</p>