title: Create generic type on const angular
body: <p>I'm having problems with error handlers. I'm trying to create a generic retryPipeline in my service: when the call fails, it retry 3 times before throw and error. So far so good. It works if I put the code inside the method, like this :</p>
  
  <pre><code>  getMun(id_del: number, id_muno: number): Observable&lt;Mun&gt; {
  
      let urlAPIMun = urlAPI;
      urlAPIMun += '/' + id_del + '/mun' + '/' + id_mun + '?flag_geometry=true';
      return this._http.get&lt;Mun&gt;(urlAPIMunicipios).pipe(
       //   tap(() =&gt; console.log('HTTP request executed')),
        retryWhen(errors =&gt; errors.pipe(
          // Concat map to keep the errors in order and make sure they
          // aren't executed in parallel
          concatMap((e: HttpErrorResponse, i) =&gt;
            // Executes a conditional Observable depending on the result
            // of the first argument
            iif(
              () =&gt; i &gt;= 3,
              // If the condition is true we throw the error (the last error)
              throwError(e.error.errores),
              // Otherwise we pipe this back into our stream and delay the retry
              of(e).pipe(delay(5000))
            )
          ))));
    }
  </code></pre>
  
  <p>I'm trying to extrac the code inside pipe to declare a const and then call the const in my service call:</p>
  
  <pre><code>const RETRYPIPELINE =
    retryWhen((errors) =&gt;
      errors.pipe(
        concatMap((e: HttpErrorResponse, i) =&gt;
            () =&gt; i &gt;= 3,
            throwError(e.error.errores),
            of(e).pipe(delay(5000))
          )
        )
      )
    );
  
  return this._http.get&lt;Mun&gt;(urlAPIMunicipios).pipe(RETRYPIPELINE);
  </code></pre>
  
  <p>But I'm receiving this error: </p>
  
  <blockquote>
    <p>error TS2322: Type 'Observable&lt;{}>' is not assignable to type 'Observable'.
          Type '{}' is missing the following properties from type 'Mun': id_mun, id_del, den</p>
  </blockquote>
  
  <p>Is there any way to create a generic const, that can be able to asign to any method, although the method returns a typed value? Thanks in advance</p>