title: Typescript: create generic Unwrap<T> helper type
body: <p>I've created a helper type to unwrap the inner type of an <code>Observable&lt;T&gt;</code>:</p>
  <pre><code>type UnwrapObservable&lt;T&gt; = T extends Observable&lt;(infer U)&gt; ? U : never;
  </code></pre>
  <p>This works just fine.  But... my next thought was, &quot;How can I make this type completely generic and apply to any type, not just Observable, essentially <code>Unwrap&lt;T&gt;</code>?</p>
  <p>Here's what I tried:</p>
  <pre><code>type Unwrap&lt;T, W&gt; = T extends W&lt;(infer U)&gt; ? U : never;
  </code></pre>
  <p>But I get:</p>
  <blockquote>
  <p>Type 'W' is not generic. ts(2315)</p>
  </blockquote>
  <p>How can I create a type that unwraps any specified type?</p>