title: Exposing an array of object using class-transformer
body: <p>I am not able to expose an array of objects.
  The Followers array is not getting exposed, even though I exposed in the <code>UserDto</code></p>
  <p>this is what I am getting,</p>
  <pre><code>{
      &quot;id&quot;: &quot;5ff4ec30-d3f4-43d3-b5ad-82b03e1c5481&quot;,
      &quot;userName&quot;: &quot;jdbfjl&quot;,
      &quot;email&quot;: &quot;jdfbaj@gmail.com&quot;,
      &quot;bio&quot;: &quot;Duuude&quot;,
      &quot;avatar&quot;: &quot;sjldflaeulajsnlnaefb&quot;,
      &quot;followerCount&quot;: 0,
      &quot;followeeCount&quot;: 0,
      &quot;verified&quot;: false,
      &quot;followers&quot;: [
        {},
        {},
        {}
      ],
      &quot;followees&quot;: [
        {}
      ]
    }
  </code></pre>
  <p>and expected is like</p>
  <pre><code>{
      &quot;id&quot;: &quot;5ff4ec30-d3f4-43d3-b5ad-82b03e1c5481&quot;,
      &quot;createdAt&quot;: &quot;2021-08-11T11:07:11.688Z&quot;,
      &quot;updatedAt&quot;: &quot;2021-08-11T11:07:11.688Z&quot;,
      &quot;userName&quot;: &quot;ashdviah&quot;,
      &quot;email&quot;: &quot;hsdvhas@gmail.com&quot;,
      &quot;bio&quot;: &quot;I am Handsome&quot;,
      &quot;avatar&quot;: &quot;sjldflaeulajsnlnaefb&quot;,
      &quot;followerCount&quot;: 0,
      &quot;followeeCount&quot;: 0,
      &quot;verified&quot;: false,
      &quot;followers&quot;: [
        {
          &quot;id&quot;: &quot;db1d30c6-5607-4d87-8838-69f906c3c44e&quot;,
          &quot;createdAt&quot;: &quot;2021-08-11T11:09:33.018Z&quot;,
          &quot;updatedAt&quot;: &quot;2021-08-11T11:09:33.018Z&quot;
        },
        {
          &quot;id&quot;: &quot;31492cd6-7c56-48f6-aff3-792a980b5100&quot;,
          &quot;createdAt&quot;: &quot;2021-08-11T11:11:01.288Z&quot;,
          &quot;updatedAt&quot;: &quot;2021-08-11T11:11:01.288Z&quot;
        },
      ],
      &quot;followees&quot;: [
        {
          &quot;id&quot;: &quot;ab095d0d-b9fa-41a4-be35-13fe9dd6f7a1&quot;,
          &quot;createdAt&quot;: &quot;2021-08-11T12:55:18.139Z&quot;,
          &quot;updatedAt&quot;: &quot;2021-08-11T12:55:18.139Z&quot;
        }
      ]
    }
  </code></pre>
  <p>I am getting this output when I am not specifying interceptor to that route... But it turns out that I am exposing password entry with it...</p>
  <p>my current approach is something like this : which is not working as expected... what am i missing here ?</p>
  <pre><code>class mock {
    @Expose() id : string;
    @Expose() createdAt : Date;
    @Expose() updatedAt : Date;
  }
  
  export class UserDto {
    @Expose()
    id : string;
    
    @Expose()
    userName : string;
    
    @Expose()
    email : string;
  
    @Expose()
    bio : string;
  
    @Expose()
    avatar : string;
  
    @Expose()
    followerCount : number;
  
    @Expose()
    followeeCount : number;
  
    @Expose()
    verified : boolean;
  
    @Expose()
    followers : Array&lt;mock&gt;;
  
    @Expose()
    followees : Array&lt;mock&gt;;
  }
  
  </code></pre>
  <p>And transform is getting done by one interceptor that I used at the controller.</p>
  <p>usage : <code>@Serialize(UserDto)</code> decorator</p>
  <pre><code>export function Serialize(dto: ClassConstructor) {
    return UseInterceptors(new Serializeinterceptor(dto));
  }
  
  export class Serializeinterceptor implements NestInterceptor {
    constructor(private dto: any) {}
  
    intercept(context: ExecutionContext, handler: CallHandler) {
      return handler.handle().pipe(
        map((data: any) =&gt; {
          return plainToClass(this.dto, data, {
            excludeExtraneousValues: true,
          });
        }),
      );
    }
  }
  </code></pre>