title: Deep Omit with typescript
body: <p>Is it possible to maintain type coverage on a function that deeply removes all instances of a key in an object?</p>
  
  <p>My function looks like this.</p>
  
  <pre><code>function omitDeep&lt;T extends object&gt;(obj: T, key: string): TWithoutProvidedKey {
    return JSON.parse(
      JSON.stringify(obj),
      (key: string, value: any) =&gt; key === "__typename" ? undefined : value
    );
  }
  </code></pre>
  
  <p>Is there any way to make <code>TWithoutProvidedKey</code> a reality?</p>