title: Transform class to class/object (Entity to DTO) in TypeScript and NestS
body: <p>How to transform database entity <code>User</code>:</p>
  
  <pre><code>class User {
    public firstName: string;
    public lastName: string;
    public phone?: string;
    public email: string;
    public status: EUserState;
    public tokens: Token[];
    public password: string;
  }
  
  </code></pre>
  
  <p>into DTO entity <code>GetUserDTO</code>:</p>
  
  <pre><code>class GetUserDTO {
    public id: number;
    public firstName: string;
    public lastName: string;
    public phone?: string;
    public email: string;
  }
  </code></pre>
  
  <p>in TypeScript? I am using <code>@nestjs</code>, <code>class-validator</code> and <code>class-transformer</code> packages, but I not found any way to use them to achieve this.</p>
  
  <p>Somebody can say, that having DTO is pointless for this, but we have DTOs shared between server and client to maintain API structure.</p>
  
  <p>Any ideas?</p>