Closed LookinGit closed 2 years ago
Hello, core team!
A type of rule mobile has params 'strict' and 'locales': https://github.com/adonisjs/validator/blob/0ac7e4b24c320ade5a79d481791a7962165b10fd/adonis-typings/validator.ts#L868
mobile
but a validator check a 'locale' parameter: https://github.com/adonisjs/validator/blob/0ac7e4b24c320ade5a79d481791a7962165b10fd/src/Validations/string/mobile.ts#L29
Error:
rules.mobile({ strict: true, locale: ['pt-BR'] }) // TypeScript error: 'locale' not found
Temporary solution:
rules.mobile({ strict: true, locale: ['pt-BR'] } as any)
Need update typings or rename property in compile mobile rule:
compile
compile: wrapCompile(RULE_NAME, ['string'], ([options]) => { options = Object.assign({}, options) return { compiledOptions: { strict: options.strict || false, locale: options.locales, }, } }),
If need I can send PR with a fix. But need to decide what to fix - compile or typings.
v12.2.2
16.14.2 8.5.0
public schema = schema.create({ phone: schema.string({ trim: true }, [ rules.mobile({ strict: true, locale: ['pt-BR'] }) ]), })
Hello, core team!
Prerequisites
A type of rule
mobile
has params 'strict' and 'locales': https://github.com/adonisjs/validator/blob/0ac7e4b24c320ade5a79d481791a7962165b10fd/adonis-typings/validator.ts#L868but a validator check a 'locale' parameter: https://github.com/adonisjs/validator/blob/0ac7e4b24c320ade5a79d481791a7962165b10fd/src/Validations/string/mobile.ts#L29
Error:
Temporary solution:
Need update typings or rename property in
compile
mobile rule:If need I can send PR with a fix. But need to decide what to fix -
compile
or typings.Package version
v12.2.2
Node.js and npm version
16.14.2 8.5.0
Sample Code (to reproduce the issue)