title: Typescript declaring a generic function and assigning an arrow function to it
body: <p>I'm trying to write a template function, that is an arrow function, and assign it to a <code>const</code> variable,</p>
  
  <p>This is supposed to be of the form <code>const method: MethodType&lt;T&gt; = &lt;T&gt;(...) =&gt; { ... }</code></p>
  
  <p>But it complains when I try to type the variable <code>method</code>. Below is a snippet of the code:</p>
  
  <pre><code>export type KeyMethod&lt;T&gt; = (data: T) =&gt; any;
  
  export interface DiffResult&lt;T&gt; {
      additions: T[];
      updates: T[];
      deletes: T[];
  };
  
  export type DiffMethod&lt;T&gt; = (oldState: T[], newState: T[]) =&gt; DiffResult&lt;T&gt;;
  
                       it complains about this template
                                     vvv
  export const diffMethod: DiffMethod&lt;T&gt; = &lt;T&gt;(oldState: T[], newState: T[]) =&gt; {
      return {
          additions: [],
          updates: [],
          deletes: []
      }
  };
  </code></pre>
  
  <p>Is there any way to do this? maybe I'm failing to follow the syntax, but I haven't found a similar example for that.</p>