title: Deep clone in TypeScript (preserving types)
body: <p>I need to deep clone an object in TypeScript. This shouldn't be a problem as libraries like Lodash provide appropriate functions for that. However, these seem to discard type information.</p>
  
  <pre><code>&gt; var a = new SomeClass();
  &gt; a instanceof SomeClass;
  &lt; true
  &gt; var b = _.cloneDeep(a);
  &gt; b instanceof SomeClass;
  &lt; false
  </code></pre>
  
  <p>Is there a way to clone objects in TypeScript while preserving this typing information?</p>