title: typescript inference of generics argument of type not assignable
body: <p>I am trying to infer the <code>data</code> type in my doAction from the generic type of my <code>GAction</code></p>
  <p>I don't understand why I get the error message <code>Argument of type 'string | number' is not assignable to parameter of type 'never'. Type 'string' is not assignable to type 'never'.</code>
  Please help me understand what I am doing wrong.</p>
  <pre><code>abstract class Action&lt;GData&gt; {
    abstract isValid(data : GData): boolean
  
    static dostuff&lt;GData&gt;(action: Action&lt;GData&gt;, data : GData): boolean {
      return action.isValid(data);
    }
  }
    abstract class State&lt;GAction extends Action&lt;any&gt;&gt; {
      abstract doAction(action: GAction, data: any): State&lt;GAction&gt; 
    }
    
    class NextAction extends Action&lt;string&gt; {
      isValid(data: string): boolean {
        return (data === &quot;222&quot;)
      }
    }
    
    class LastAction extends Action&lt;number&gt; {
      isValid(data : number): boolean {
        return (data === 254);
      }
    
    }
    
    type AllStateActions = LastAction | NextAction 
  
    type ActionData&lt;S&gt; = S extends Action&lt;infer H&gt; ? H : never;
    class OneState extends State&lt;AllStateActions&gt; {
      doAction&lt;GAction extends AllStateActions, GData extends ActionData&lt;GAction&gt;&gt; (action: GAction , data: GData): OneState {
        if(!action.isValid(data)) {
          return this;
        }
        return this; 
      }
    
    }
  </code></pre>