From 72da365249419a438a474766afb189499b17cfaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20My=C5=9Bliwiec?= Date: Tue, 1 Aug 2023 11:05:01 +0200 Subject: [PATCH] fix: check if keys with validation constraints exist --- lib/type-helpers/partial-type.helper.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/type-helpers/partial-type.helper.ts b/lib/type-helpers/partial-type.helper.ts index d7bbaff6c..1872b8ad1 100644 --- a/lib/type-helpers/partial-type.helper.ts +++ b/lib/type-helpers/partial-type.helper.ts @@ -27,9 +27,11 @@ export function PartialType(classRef: Type): Type> { classRef, PartialTypeClass ); - keysWithValidationConstraints - .filter((key) => !fields.includes(key)) - .forEach((key) => applyIsOptionalDecorator(PartialTypeClass, key)); + if (keysWithValidationConstraints) { + keysWithValidationConstraints + .filter((key) => !fields.includes(key)) + .forEach((key) => applyIsOptionalDecorator(PartialTypeClass, key)); + } inheritTransformationMetadata(classRef, PartialTypeClass);