title: Clean way to map objects to other objects?
body: <p>Is there a good way to map objects to other objects? Library recommendations welcome too.</p>
  
  <p>For example, say I have these classes:</p>
  
  <pre><code>export class Draft {
      id: number;
      name: string;
      summary: string;
  }
  
  export class Book {
      id: number;
      name: string;
      info: Info;
  }
  
  export class Info {
      value: string;
  }
  </code></pre>
  
  <p>Traditionally, to map fields from <code>Draft</code> to <code>Book</code> I'd have to do so manually for each field:</p>
  
  <pre><code>export class Book {
      [...]
  
      fromDraft(Draft draft) {
          this.id = draft.id;
          this.name = draft.name;
          this.info = new Info();
          this.info.value = draft.summary;
      }
  }
  </code></pre>
  
  <p>Is there an easier way to map object fields that are named the same way? For example <code>Draft</code> and <code>Book</code>'s <code>id</code> and <code>name</code> fields, while also being able to define custom mappings, like from <code>draft.summary</code> to <code>book.info.value</code>.</p>
  
  <p>Note that this is far from my actual use case. Here it's not so bad to do assignments manually, but for objects with many similarly named fields it's quite a chore.</p>
  
  <p>Thanks!</p>