Skip to content

Commit

Permalink
fix(): fix clonePrimitiveLiteral is undefined issue on Length decorator
Browse files Browse the repository at this point in the history
* fixes an issue adding minLength and maxLength properties when using Length with an expression
  • Loading branch information
cantecim authored Dec 26, 2023
1 parent 5108ba6 commit e5be51e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/plugin/visitors/model-class.visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -649,7 +649,7 @@ export class ModelClassVisitor extends AbstractFileVisitor {
const clonedMaxLength = this.clonePrimitiveLiteral(
factory,
maxLength
);
) ?? maxLength;
if (clonedMaxLength) {
result.push(
factory.createPropertyAssignment('maxLength', clonedMaxLength)
Expand Down

0 comments on commit e5be51e

Please sign in to comment.