title: What does double type declarations in TypeScript mean?
body: <p>I was doing the Angular tutorial <a href="https://angular.io/tutorial/toh-pt6#error-handling" rel="nofollow noreferrer">here</a></p>
  
  <p>The following piece of code have double type declarations, but I don't understand what it means.</p>
  
  <pre><code>handleError&lt;T&gt;(operation = 'operation', result?: T) {
     return (error: any): Observable&lt;T&gt; =&gt; {
        console.error(error);
  
        this.log(`${operation} failed: ${error.message}`);
  
        return of(result as T);
     };
  }
  </code></pre>
  
  <p>So error is declared as of type any, then there's another colon to declare a function with Observable as the parameter. What exactly is it returning?</p>