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

Update Validation type #660

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update Validation type #660

wants to merge 1 commit into from

Conversation

th3fallen
Copy link

Update Validation type for custom added validators that leverage the extra argument

Tests run directly on the source code and all dist changes are computed and committed during Formsy release.

Update Validation type for custom added validators that leverage the extra argument
@th3fallen
Copy link
Author

th3fallen commented Mar 3, 2022

This resolves the Ts issue regarding validators that leverage the extra argument like so.

validations={ {
                'isNumeric': true,
                'isGte': min,
                'isLte': max,
              } }
export function isGte(values, value, min) {
  if (!value && value !== 0) {
    return true;
  }
  return value >= min;
}

@felixmosh
Copy link
Contributor

@th3fallen sorry for the delay, can you elaborate when do you get a type error? (a small example will be really appreciated).

@rkuykendall
Copy link
Member

@felixmosh I think I get this. The type error example here is { 'isLte': max }, where max isn't a boolean or a string or a function, so it does not match the previous type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants