title: Automatic type inference for class property parameters
body: <p>I am using a library called <a href="https://github.com/yysun/apprun" rel="nofollow noreferrer">apprun</a>. The Component class type defintion (here is <a href="https://github.com/yysun/apprun/blob/master/src/component.ts" rel="nofollow noreferrer">its implementation</a>) looks as follow:</p>
  
  <pre><code>  export type View&lt;T&gt; = (state: T) =&gt; string | VNode | VNode[] | void;
  
    export class Component&lt;T=any&gt; {
      constructor(state?: T, view?: View&lt;T&gt;, update?: Update&lt;T&gt;);
      readonly state: T;
      setState(state: T, options?: { render?: boolean, history?: boolean }): void;
      mount(element?: Element, options?: { render?: boolean, history?, global_event?: boolean }): Component&lt;T&gt;;
      start(element?: Element, options?: { render?: boolean, history?, global_event?: boolean }): Component&lt;T&gt;;
      on(name: string, fn: (...args: any[]) =&gt; void, options?: any): void;
      run(name: string, ...args: any[]): number;
      rendered: (state: T) =&gt; void;
      mounted: (props: any) =&gt; void;
      unmount: () =&gt; void;
      unload: () =&gt; void;
    }
  </code></pre>
  
  <p>When I use this class in my own components, I am having issues with the type inference:</p>
  
  <pre><code>interface State {
    foo: string
  }
  
  export class AboutPage extends Component&lt;State&gt; {
    // State is correctly inferred.
    // Changing `foo` to be `1` will cause an error.
    state = {
      foo: 'bar'
    }
  
    // Parameter `state` implicitly has an 'any' type.
    // Why is the parameter not inferred just like the `state` property?
    view = (state) =&gt; &lt;div&gt;About&lt;/div&gt;
  }
  </code></pre>
  
  <p>What I am having trouble with is understanding why the type for the property <code>state</code> is inferred and why isn't the same thing happening for the parameter <code>state</code>?</p>