With two DTO in NestJS
given class ADto
& class BDto
class ADto extends PartialType(BDto)
type-coercion fails.
(Params are not converted to number from string, resulting in class-validator throwing an error).
If class ADto extends BDto
, all works.
Why does using PartialType not include type-coercion?
Unfortunately it seems that the
class-validator
library simply does not support generics (whichPartial<T>
types are):