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

Enhance Typings #1115

Closed
ig-onoffice-de opened this issue Sep 30, 2022 · 1 comment · May be fixed by #1177
Closed

Enhance Typings #1115

ig-onoffice-de opened this issue Sep 30, 2022 · 1 comment · May be fixed by #1177

Comments

@ig-onoffice-de
Copy link

Is your feature request related to a problem? Please describe.

  1. Type of ValidationRule doesn't have the possibility to pass the Params type to the generic
  2. Function helpers.withParams doesn't have the possibiltiy to pass the Params type neither
  3. Function helpers.regex doesn't habe a ReturnType at all

Describe the solution you'd like

  1. Change
export type ValidationRule <T = any> = ValidationRuleWithParams<any, T> | ValidationRuleWithoutParams<T> | ValidatorFn<T>;

to

export type ValidationRule <T = any, P extends object = object> = ValidationRuleWithParams<P, T> | ValidationRuleWithoutParams<T> | ValidatorFn<T>;
  1. Change
withParams: <T = unknown>(params: object, validator: ValidationRule<T>) => ValidationRuleWithParams

to

withParams: <T = unknown, P extends object = object>(params: P, validator: ValidationRule<T>) => ValidationRuleWithParams<P, T>
  1. Change
regex: Function

to

regex: <T = any, K = any, S = any>(regex: RegExp)=>ValidatorFn< T, K, S>

With this one I'm not really sure about the return type.

Describe alternatives you've considered

Additional context
Add any other context or screenshots about the feature request here.

@dobromir-hristov
Copy link
Contributor

Please feel free to open a PR.

ig-onoffice-de added a commit to ig-onoffice-de/vuelidate that referenced this issue Nov 16, 2022
…more explicit type

the type `Function` was not very explicit about what parameters the function needs or what it returns

closes vuelidate#1115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants