NestJS · Junior · Question 62 of 75
What does ClassSerializerInterceptor do together with class-transformer?
export class UserEntity {
id: number;
email: string;
@Exclude()
password: string;
}- ✓Correct answer: Applies transformation rules like
@Exclude()when the handler returns class instances, sopasswordisn't sent - 2Encrypts the response
- 3Validates the request body
Explanation
It works on class instances, not plain objects. Return new UserEntity(...) or map to a response DTO.