title: TypeScript: Type 'T' does not satisfy the constraint '(...args: any) => any'
body: <p>I have the following redux-thunk action creator:</p>
  
  <pre><code>function updateInitiator(form_request_id, { to_recipient }) {
    return (dispatch) =&gt; {
      const url = `/some/url`;
      const data = { to_recipient };
  
      return fetch(url, { method: 'PUT', body: JSON.stringify(data) }).then(() =&gt; {
        dispatch(fetchResponses());
      });
    };
  }
  </code></pre>
  
  <p>Then I declare the type of the function:</p>
  
  <pre><code>type UpdateInitiator = typeof updateInitiator;
  </code></pre>
  
  <p>I'm trying to derive the type of a bound thunk action. In short, when the action creator is "bound" in react-redux, it automatically calls the function returned with <code>dispatch</code> and then returns the return result of <em>that</em> internal function. I'm trying to declare a type for this behavior. It works if I do it without generics:</p>
  
  <pre><code>type BoundUpdateInitiator = (...args: Parameters&lt;UpdateInitiator&gt;) =&gt; ReturnType&lt;ReturnType&lt;UpdateInitiator&gt;&gt;;
  </code></pre>
  
  <p>But when I try to declare a generic type for any bound function, I'm having some trouble:</p>
  
  <pre><code>type BoundThunk&lt;T&gt; = (...args: Parameters&lt;T&gt;) =&gt; ReturnType&lt;ReturnType&lt;T&gt;&gt;;
  type BoundUpdateInitiator = BoundThunk&lt;UpdateInitiator&gt;;
  </code></pre>
  
  <p>This gives me the error:</p>
  
  <pre><code>error TS2344: Type 'T' does not satisfy the constraint '(...args: any) =&gt; any'.
  
  236 type BoundThunk&lt;T&gt; = (...args: Parameters&lt;T&gt;) =&gt; ReturnType&lt;ReturnType&lt;T&gt;&gt;;
                                                ~
  
  error TS2344: Type 'ReturnType&lt;T&gt;' does not satisfy the constraint '(...args: any) =&gt; any'.
    Type 'unknown' is not assignable to type '(...args: any) =&gt; any'.
      Type '{}' provides no match for the signature '(...args: any): any'.
  
  236 type BoundThunk&lt;T&gt; = (...args: Parameters&lt;T&gt;) =&gt; ReturnType&lt;ReturnType&lt;T&gt;&gt;;
                                                                  ~~~~~~~~~~~~~
  
  error TS2344: Type 'T' does not satisfy the constraint '(...args: any) =&gt; any'.
  
  236 type BoundThunk&lt;T&gt; = (...args: Parameters&lt;T&gt;) =&gt; ReturnType&lt;ReturnType&lt;T&gt;&gt;;
                                                                             ~
  
  </code></pre>
  
  <p>I can vaguely understand that <code>T</code> might be things other than a function, and similarly <code>ReturnType&lt;T&gt;</code> might also not be a function, and this generic type maybe doesn't account for those cases. I'm having trouble understanding how I <em>can</em> account for them, however. Ideally by not allowing them. Any suggestions?</p>