Consider the code snippet below:
@Post()
public async createPet(@Body() petDetails: PostPetDto): Promise<any> {
}
In this scenario, the type of @Bod() petDetails
defaults to plain/any instead of the declared type of PostPetDto
. What is the recommended approach in NestJS to ensure it adheres to the correct type?
The type includes methods (such as validate) that need to be executed.