title: Order of generic parameters in typescript causes the parameter to be interfered as {}
body: <p>I'm trying to write typings for compose function for the following scenario.   </p>
  
  <pre><code>  interface ReducerBuilder&lt;InS, OutS&gt; {
  
      }
      interface State {
        hue2: number,
        hue3: string,
        hue: string;
      }
  
      declare function createBaseReducer &lt;K&gt;(initialState: K): ReducerBuilder&lt;K, K&gt; ;
      declare function createReducerTestI &lt;K&gt;(builder: ReducerBuilder&lt;K, K&gt;): ReducerBuilder&lt;K, K&gt;;
  
      declare function compose&lt;TArg,TResult, TResult1&gt;(f2: (arg: TResult1) =&gt; TResult, f1: (arg: TArg) =&gt; TResult1): (arg: TArg) =&gt; TResult;
      declare function composeRev&lt;TResult, TArg, TResult1&gt;(f1: (arg: TArg) =&gt; TResult1, f2: (arg: TResult1) =&gt; TResult): (arg: TArg) =&gt; TResult;
  
      const state : State = { hue2: 5, hue3: "aa", hue: "aa" };
      const built = createReducerTestI(createBaseReducer(state));
  
      const x0 = compose(createReducerTestI, createBaseReducer)(state);
      const x1 = compose(createReducerTestI, (arg: State) =&gt; createBaseReducer(arg))(state); 
      const x2 = composeRev((arg: State) =&gt; createBaseReducer(arg), createReducerTestI)(state);
  </code></pre>
  
  <ul>
  <li>Type for <code>x0</code> is <code>ReducerBuilder&lt;{},{}&gt;</code>.  I understand that at args
  cannot be interfered here because the function returned from compose
  has no information about the type of arguments.</li>
  <li>Type for  <code>x1</code> is <code>ReducerBuilder&lt;{},{}&gt;</code>. I don't get why the type here
  is <code>{}</code>. I explicitly say <code>TArg</code> is a type of <code>State</code>. I suspect that
  Typescript is trying to interfere <code>TResult1</code> from left to right and it
  can't get it from <code>f2</code> argument.</li>
  <li>Type for <code>x2</code> is <code>ReducerBuilder&lt;State,State&gt;</code> - success. All I did was
  just to revert the order of parameters so <code>TResult1</code> could be
  interfered from left to right.</li>
  </ul>
  
  <p>I don't really want to revert the order of arguments. Is there a better way to solve this?</p>