class-validator icon indicating copy to clipboard operation
class-validator copied to clipboard

fix: Unable to resolve signature of property decorator when called as an expression.

Open zhengAnBin opened this issue 3 years ago • 3 comments

Description

Use Class-Validator in DTOs

Minimal code-snippet showcasing the problem

@isNotEmpty({ message: '' })  // ts error
@ApiProperty({ description: '手机号', example: '13222222222', required: true })
phone: number;

Actual behavior

ts: Unable to resolve signature of property decorator when called as an expression. This expression is not callable. Type 'Boolean' has no call signatures.

zhengAnBin avatar Jun 28 '21 00:06 zhengAnBin

same problem with me!

alef-carvalho avatar Dec 22 '21 00:12 alef-carvalho

Had the same issue and found out after a few hours that it is a typo. isNotEmpty should be IsNotEmpty (capital I)

Mentioned here

vineryap avatar Jul 28 '22 04:07 vineryap

thank you

zhengAnBin avatar Aug 03 '22 09:08 zhengAnBin

As mentioned by others, the decorators start with a capital letter: @IsNotEmpty. The isNotEmpty is the validator function that is used by the decorator.

Closing this as there is no action to take.

NoNameProvided avatar Dec 15 '22 23:12 NoNameProvided

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Jan 15 '23 00:01 github-actions[bot]