From e5be51e47ed814518fa0786b145f01530a434410 Mon Sep 17 00:00:00 2001 From: Can Tecim Date: Tue, 26 Dec 2023 20:03:39 +0300 Subject: [PATCH] fix(): fix clonePrimitiveLiteral is undefined issue on Length decorator * fixes an issue adding minLength and maxLength properties when using Length with an expression --- lib/plugin/visitors/model-class.visitor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugin/visitors/model-class.visitor.ts b/lib/plugin/visitors/model-class.visitor.ts index 1ca3f4ea7..656edef35 100644 --- a/lib/plugin/visitors/model-class.visitor.ts +++ b/lib/plugin/visitors/model-class.visitor.ts @@ -634,7 +634,7 @@ export class ModelClassVisitor extends AbstractFileVisitor { return result; } - const clonedMinLength = this.clonePrimitiveLiteral(factory, minLength); + const clonedMinLength = this.clonePrimitiveLiteral(factory, minLength) ?? minLength; if (clonedMinLength) { result.push( factory.createPropertyAssignment('minLength', clonedMinLength) @@ -649,7 +649,7 @@ export class ModelClassVisitor extends AbstractFileVisitor { const clonedMaxLength = this.clonePrimitiveLiteral( factory, maxLength - ); + ) ?? maxLength; if (clonedMaxLength) { result.push( factory.createPropertyAssignment('maxLength', clonedMaxLength)