title: How assign 2 different type object(complex objects) attribute by attribute with manually mapping in typescript?(like automapper in C#)
body: <p>I have 2 different type of complex object. I want to assign one of them to other by mapping attributes. How can I achieve it?</p>
  <pre><code>interface IClassA{
                  attribute1: string; //same with IClassB
                  attribute2: string; //same with IClassB
                  attribute3: number; //different type different mane with IClassB
          };
  
  
  interface IClassB{
              attribute1: string;
              attribute2: string;
              attr3: string;
      };
  
  
  
  
  
  var obj1: IClassA= {
               attribute1:  'xxx',
               attribute2:  'yyy',
               attribute3: 5
     };
  
  var obj2: IClassB;
  
  
  console.log(obj1);
  </code></pre>
  <p>Output is :</p>
  <pre><code>[LOG]: {
    &quot;attribute1&quot;: &quot;xxx&quot;,
    &quot;attribute2&quot;: &quot;yyy&quot;,
    &quot;attribute3&quot;: 5
  } 
  </code></pre>
  <p>When I want to make obj2 written, it needs to be like:</p>
  <p>&quot;attribute1&quot;: &quot;xxx&quot;,
  &quot;attribute2&quot;: &quot;yyy&quot;,
  &quot;attr3&quot;: &quot;5&quot;
  }</p>
  <p>How can I assign like that obj2 = obj1 ..   I need to map attributes by attributes, what is the best way?</p>
  <p>I dont want yo use that notation(ASSUME that I have n attribute with same name, just 1 attribute with different name)</p>
  <pre><code>obj2.attribute1 = obj1.attribute1; ..... 
  </code></pre>