title: Union of generics in array
body: <p>I am trying to get the union type of generics in an array but can only retrieve what the generic is extended from not the actual implementation.</p>
  <pre><code>type Params = Record&lt;string, number | string | null | undefined&gt; | undefined;
  type Route&lt;T extends Params = undefined&gt; = {
    params: T
  }
  type Stack = {
    routes: Route&lt;Params&gt;[];
  }
  
  const route1: Route&lt;{ detailUrl: string }&gt; = { ... };
  const route2: Route&lt;{ head: string }&gt; = { ... };
  const route3: Route = { ... };
  
  const routeRegistry: Stack = {
    routes: [route1, route2, route3]
  };
  </code></pre>
  <pre><code>type UnionOfParams = ExtractGeneric&lt;typeof routeRegistry['routes'][number]&gt;;
  // expected: { detailUrl: string } | { head: string } | undefined
  // received: Params
  </code></pre>
  <p>I know const assertion is useful to limit widening of the inference of the types, but using it in this case didn't produce any result.</p>
  <p>I couldn't find anything related to this particular problem. Is there a way to accomplish what I ask?</p>