-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Versions:
- VueJs: 2.1.10
- Vee-Validate:2.0.0.23-beta
Description:
I have a custom validation rule that returns a resolved promise. However, when I combine this custom validation with a native validation rule (like required) - In some cases, $validator.validate() returns a Boolean, but other times it returns a Promise.
This results in console errors because you cannot call .then() on a Boolean, which means I have to do a typecheck on $validator.validate() everytime I need to access the errors in the .then() callback.
Returning two different types from one function call seems like a bad design pattern.
Steps To Reproduce:
Create a custom validation rule that returns a Promise.
Extend the validator to use the custom rule.
use validator.attach() to bind the custom rule, along with the native "required" rule.
Attempt to call .then() on $validator.validate('customRule');