Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: typing #1464

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3e0b95f
build(deps-dev): bump rollup from 2.60.0 to 2.60.1 (#1415)
dependabot[bot] Nov 22, 2021
cbcc0bb
build(deps-dev): bump lint-staged from 12.0.3 to 12.1.2 (#1416)
dependabot[bot] Nov 22, 2021
81f93d0
build(deps-dev): bump eslint-plugin-jest from 25.2.4 to 25.3.0 (#1419)
dependabot[bot] Nov 23, 2021
3d392a7
build(deps-dev): bump @types/node from 16.11.9 to 16.11.10 (#1420)
dependabot[bot] Nov 24, 2021
7adbc06
build(deps-dev): bump prettier from 2.4.1 to 2.5.0 (#1425)
dependabot[bot] Nov 26, 2021
701f9b9
build(deps-dev): bump rollup from 2.60.1 to 2.60.2 (#1429)
dependabot[bot] Nov 30, 2021
699c906
build(deps-dev): bump @types/node from 16.11.10 to 16.11.11 (#1430)
dependabot[bot] Nov 30, 2021
3552c4c
build(deps): bump libphonenumber-js from 1.9.43 to 1.9.44 (#1434)
dependabot[bot] Dec 3, 2021
a35537a
build(deps-dev): bump prettier from 2.5.0 to 2.5.1 (#1436)
dependabot[bot] Dec 6, 2021
b546ca5
build(deps-dev): bump @types/node from 16.11.11 to 16.11.12 (#1437)
dependabot[bot] Dec 7, 2021
071fb68
build(deps-dev): bump rollup from 2.60.2 to 2.61.0 (#1442)
dependabot[bot] Dec 9, 2021
645bc8d
build(deps-dev): bump typescript from 4.5.2 to 4.5.3 (#1446)
dependabot[bot] Dec 10, 2021
aad3fea
build(deps-dev): bump rollup from 2.61.0 to 2.61.1 (#1447)
dependabot[bot] Dec 13, 2021
e38968a
build(deps-dev): bump typescript from 4.5.3 to 4.5.4 (#1448)
dependabot[bot] Dec 14, 2021
e238714
build(deps-dev): bump @rollup/plugin-node-resolve from 13.0.6 to 13.1…
dependabot[bot] Dec 14, 2021
392eaa6
build(deps-dev): bump @types/node from 16.11.12 to 16.11.13 (#1452)
dependabot[bot] Dec 15, 2021
57cff6d
build(deps-dev): bump @types/node from 16.11.13 to 17.0.0 (#1453)
dependabot[bot] Dec 16, 2021
f560b16
build(deps-dev): bump @types/node from 17.0.0 to 17.0.1 (#1456)
dependabot[bot] Dec 20, 2021
4e39a04
build(deps-dev): bump lint-staged from 12.1.2 to 12.1.3 (#1458)
dependabot[bot] Dec 20, 2021
f3b1daa
build(deps-dev): bump @types/node from 17.0.1 to 17.0.2 (#1459)
dependabot[bot] Dec 21, 2021
d8835a9
build(deps-dev): bump @types/node from 17.0.2 to 17.0.4 (#1461)
dependabot[bot] Dec 24, 2021
89280f7
build(deps-dev): bump rollup from 2.61.1 to 2.62.0 (#1462)
dependabot[bot] Dec 24, 2021
d9ab052
build(deps-dev): bump @types/validator from 13.7.0 to 13.7.1 (#1463)
dependabot[bot] Dec 24, 2021
0dd0882
fix: typing
ruscon Dec 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
244 changes: 128 additions & 116 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,30 @@
"test:ci": "jest --runInBand --no-cache --coverage --verbose"
},
"dependencies": {
"libphonenumber-js": "^1.9.43",
"libphonenumber-js": "^1.9.44",
"validator": "^13.7.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-node-resolve": "^13.1.1",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.9",
"@types/validator": "^13.7.0",
"@types/node": "^17.0.4",
"@types/validator": "^13.7.1",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.4",
"eslint-plugin-jest": "^25.3.0",
"husky": "^4.3.8",
"jest": "^26.6.3",
"lint-staged": "^12.0.3",
"prettier": "^2.2.1",
"lint-staged": "^12.1.3",
"prettier": "^2.5.1",
"reflect-metadata": "0.1.13",
"rimraf": "3.0.2",
"rollup": "^2.60.0",
"rollup": "^2.62.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^26.5.6",
"ts-node": "^10.4.0",
"typescript": "^4.2.4"
"typescript": "^4.5.4"
}
}
2 changes: 1 addition & 1 deletion src/decorator/array/ArrayContains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function ArrayContains(values: any[], validationOptions?: ValidationOptio
name: ARRAY_CONTAINS,
constraints: [values],
validator: {
validate: (value, args): boolean => arrayContains(value, args.constraints[0]),
validate: (value, args): boolean => arrayContains(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must contain $constraint1 values',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/array/ArrayMaxSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function ArrayMaxSize(max: number, validationOptions?: ValidationOptions)
name: ARRAY_MAX_SIZE,
constraints: [max],
validator: {
validate: (value, args): boolean => arrayMaxSize(value, args.constraints[0]),
validate: (value, args): boolean => arrayMaxSize(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must contain not more than $constraint1 elements',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/array/ArrayMinSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function ArrayMinSize(min: number, validationOptions?: ValidationOptions)
name: ARRAY_MIN_SIZE,
constraints: [min],
validator: {
validate: (value, args): boolean => arrayMinSize(value, args.constraints[0]),
validate: (value, args): boolean => arrayMinSize(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must contain at least $constraint1 elements',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/array/ArrayNotContains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function ArrayNotContains(values: any[], validationOptions?: ValidationOp
name: ARRAY_NOT_CONTAINS,
constraints: [values],
validator: {
validate: (value, args): boolean => arrayNotContains(value, args.constraints[0]),
validate: (value, args): boolean => arrayNotContains(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property should not contain $constraint1 values',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/common/Equals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function Equals(comparison: any, validationOptions?: ValidationOptions):
name: EQUALS,
constraints: [comparison],
validator: {
validate: (value, args): boolean => equals(value, args.constraints[0]),
validate: (value, args): boolean => equals(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be equal to $constraint1',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/common/IsIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function IsIn(values: readonly any[], validationOptions?: ValidationOptio
name: IS_IN,
constraints: [values],
validator: {
validate: (value, args): boolean => isIn(value, args.constraints[0]),
validate: (value, args): boolean => isIn(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be one of the following values: $constraint1',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/common/IsNotIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function IsNotIn(values: readonly any[], validationOptions?: ValidationOp
name: IS_NOT_IN,
constraints: [values],
validator: {
validate: (value, args): boolean => isNotIn(value, args.constraints[0]),
validate: (value, args): boolean => isNotIn(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property should not be one of the following values: $constraint1',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/common/NotEquals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function NotEquals(comparison: any, validationOptions?: ValidationOptions
name: NOT_EQUALS,
constraints: [comparison],
validator: {
validate: (value, args): boolean => notEquals(value, args.constraints[0]),
validate: (value, args): boolean => notEquals(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property should not be equal to $constraint1',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/date/MaxDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function MaxDate(date: Date, validationOptions?: ValidationOptions): Prop
name: MAX_DATE,
constraints: [date],
validator: {
validate: (value, args): boolean => maxDate(value, args.constraints[0]),
validate: (value, args): boolean => maxDate(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => 'maximal allowed date for ' + eachPrefix + '$property is $constraint1',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/date/MinDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function MinDate(date: Date, validationOptions?: ValidationOptions): Prop
name: MIN_DATE,
constraints: [date],
validator: {
validate: (value, args): boolean => minDate(value, args.constraints[0]),
validate: (value, args): boolean => minDate(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => 'minimal allowed date for ' + eachPrefix + '$property is $constraint1',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/number/IsDivisibleBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function IsDivisibleBy(num: number, validationOptions?: ValidationOptions
name: IS_DIVISIBLE_BY,
constraints: [num],
validator: {
validate: (value, args): boolean => isDivisibleBy(value, args.constraints[0]),
validate: (value, args): boolean => isDivisibleBy(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be divisible by $constraint1',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/number/Max.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function Max(maxValue: number, validationOptions?: ValidationOptions): Pr
name: MAX,
constraints: [maxValue],
validator: {
validate: (value, args): boolean => max(value, args.constraints[0]),
validate: (value, args): boolean => max(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must not be greater than $constraint1',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/number/Min.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function Min(minValue: number, validationOptions?: ValidationOptions): Pr
name: MIN,
constraints: [minValue],
validator: {
validate: (value, args): boolean => min(value, args.constraints[0]),
validate: (value, args): boolean => min(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must not be less than $constraint1',
validationOptions
Expand Down
6 changes: 3 additions & 3 deletions src/decorator/object/IsInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export function IsInstance(
name: IS_INSTANCE,
constraints: [targetType],
validator: {
validate: (value, args): boolean => isInstance(value, args.constraints[0]),
validate: (value, args): boolean => isInstance(value, args?.constraints[0]),
defaultMessage: buildMessage((eachPrefix, args) => {
if (args.constraints[0]) {
return eachPrefix + `$property must be an instance of ${args.constraints[0].name as string}`;
if (args?.constraints[0]) {
return eachPrefix + `$property must be an instance of ${args?.constraints[0].name as string}`;
} else {
return eachPrefix + `${IS_INSTANCE} decorator expects and object as value, but got falsy value.`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/object/IsNotEmptyObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function IsNotEmptyObject(
name: IS_NOT_EMPTY_OBJECT,
constraints: [options],
validator: {
validate: (value, args): boolean => isNotEmptyObject(value, args.constraints[0]),
validate: (value, args): boolean => isNotEmptyObject(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be a non-empty object',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/Contains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function Contains(seed: string, validationOptions?: ValidationOptions): P
name: CONTAINS,
constraints: [seed],
validator: {
validate: (value, args): boolean => contains(value, args.constraints[0]),
validate: (value, args): boolean => contains(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must contain a $constraint1 string',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsAlpha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function IsAlpha(locale?: string, validationOptions?: ValidationOptions):
name: IS_ALPHA,
constraints: [locale],
validator: {
validate: (value, args): boolean => isAlpha(value, args.constraints[0]),
validate: (value, args): boolean => isAlpha(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must contain only letters (a-zA-Z)',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsAlphanumeric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function IsAlphanumeric(locale?: string, validationOptions?: ValidationOp
name: IS_ALPHANUMERIC,
constraints: [locale],
validator: {
validate: (value, args): boolean => isAlphanumeric(value, args.constraints[0]),
validate: (value, args): boolean => isAlphanumeric(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must contain only letters and numbers',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsByteLength.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function IsByteLength(min: number, max?: number, validationOptions?: Vali
name: IS_BYTE_LENGTH,
constraints: [min, max],
validator: {
validate: (value, args): boolean => isByteLength(value, args.constraints[0], args.constraints[1]),
validate: (value, args): boolean => isByteLength(value, args?.constraints[0], args?.constraints[1]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + "$property's byte length must fall into ($constraint1, $constraint2) range",
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsCurrency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function IsCurrency(
name: IS_CURRENCY,
constraints: [options],
validator: {
validate: (value, args): boolean => isCurrency(value, args.constraints[0]),
validate: (value, args): boolean => isCurrency(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a currency', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsDecimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function IsDecimal(
name: IS_DECIMAL,
constraints: [options],
validator: {
validate: (value, args): boolean => isDecimal(value, args.constraints[0]),
validate: (value, args): boolean => isDecimal(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property is not a valid decimal number.',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function IsEmail(
name: IS_EMAIL,
constraints: [options],
validator: {
validate: (value, args): boolean => isEmail(value, args.constraints[0]),
validate: (value, args): boolean => isEmail(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be an email', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsFQDN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function IsFQDN(options?: ValidatorJS.IsFQDNOptions, validationOptions?:
name: IS_FQDN,
constraints: [options],
validator: {
validate: (value, args): boolean => isFQDN(value, args.constraints[0]),
validate: (value, args): boolean => isFQDN(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be a valid domain name',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function IsHash(algorithm: string, validationOptions?: ValidationOptions)
name: IS_HASH,
constraints: [algorithm],
validator: {
validate: (value, args): boolean => isHash(value, args.constraints[0]),
validate: (value, args): boolean => isHash(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be a hash of type $constraint1',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsIP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function IsIP(version?: IsIpVersion, validationOptions?: ValidationOption
name: IS_IP,
constraints: [version],
validator: {
validate: (value, args): boolean => isIP(value, args.constraints[0]),
validate: (value, args): boolean => isIP(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be an ip address', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsISBN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function IsISBN(version?: IsISBNVersion, validationOptions?: ValidationOp
name: IS_ISBN,
constraints: [version],
validator: {
validate: (value, args): boolean => isISBN(value, args.constraints[0]),
validate: (value, args): boolean => isISBN(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be an ISBN', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsISO8601.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function IsISO8601(
name: IS_ISO8601,
constraints: [options],
validator: {
validate: (value, args): boolean => isISO8601(value, args.constraints[0]),
validate: (value, args): boolean => isISO8601(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be a valid ISO 8601 date string',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsISSN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function IsISSN(options?: ValidatorJS.IsISSNOptions, validationOptions?:
name: IS_ISSN,
constraints: [options],
validator: {
validate: (value, args): boolean => isISSN(value, args.constraints[0]),
validate: (value, args): boolean => isISSN(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a ISSN', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsIdentityCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function IsIdentityCard(
name: IS_IDENTITY_CARD,
constraints: [locale],
validator: {
validate: (value, args): boolean => isIdentityCard(value, args.constraints[0]),
validate: (value, args): boolean => isIdentityCard(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be a identity card number',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsMobilePhone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function IsMobilePhone(
name: IS_MOBILE_PHONE,
constraints: [locale, options],
validator: {
validate: (value, args): boolean => isMobilePhone(value, args.constraints[0], args.constraints[1]),
validate: (value, args): boolean => isMobilePhone(value, args?.constraints[0], args?.constraints[1]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a phone number', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsNumberString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function IsNumberString(
name: IS_NUMBER_STRING,
constraints: [options],
validator: {
validate: (value, args): boolean => isNumberString(value, args.constraints[0]),
validate: (value, args): boolean => isNumberString(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a number string', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsPassportNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function IsPassportNumber(countryCode: string, validationOptions?: Valida
name: IS_PASSPORT_NUMBER,
constraints: [countryCode],
validator: {
validate: (value, args): boolean => isPassportNumber(value, args.constraints[0]),
validate: (value, args): boolean => isPassportNumber(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be valid passport number',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsPhoneNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function IsPhoneNumber(region?: CountryCode, validationOptions?: Validati
name: IS_PHONE_NUMBER,
constraints: [region],
validator: {
validate: (value, args): boolean => isPhoneNumber(value, args.constraints[0]),
validate: (value, args): boolean => isPhoneNumber(value, args?.constraints[0]),
defaultMessage: buildMessage(
eachPrefix => eachPrefix + '$property must be a valid phone number',
validationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsPostalCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function IsPostalCode(
name: IS_POSTAL_CODE,
constraints: [locale],
validator: {
validate: (value, args): boolean => isPostalCode(value, args.constraints[0]),
validate: (value, args): boolean => isPostalCode(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a postal code', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsRgbColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function IsRgbColor(includePercentValues?: boolean, validationOptions?: V
name: IS_RGB_COLOR,
constraints: [includePercentValues],
validator: {
validate: (value, args): boolean => isRgbColor(value, args.constraints[0]),
validate: (value, args): boolean => isRgbColor(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be RGB color', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsUUID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function IsUUID(version?: UUIDVersion, validationOptions?: ValidationOpti
name: IS_UUID,
constraints: [version],
validator: {
validate: (value, args): boolean => isUUID(value, args.constraints[0]),
validate: (value, args): boolean => isUUID(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a UUID', validationOptions),
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/decorator/string/IsUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function IsUrl(options?: ValidatorJS.IsURLOptions, validationOptions?: Va
name: IS_URL,
constraints: [options],
validator: {
validate: (value, args): boolean => isURL(value, args.constraints[0]),
validate: (value, args): boolean => isURL(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be an URL address', validationOptions),
},
},
Expand Down
Loading