NestJS · Junior · Question 62 of 75

What does ClassSerializerInterceptor do together with class-transformer?

export class UserEntity {
  id: number;
  email: string;

  @Exclude()
  password: string;
}

Explanation

It works on class instances, not plain objects. Return new UserEntity(...) or map to a response DTO.

Further reading

Problem with a question

NestJS · Junior · question 62

Test yourself

Take the NestJS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz