Skip to content

Commit

Permalink
fix(types): build issue with typescript undefined error (#1024)
Browse files Browse the repository at this point in the history
* Update index.d.ts

enforce the ValidationArgs to have a value and force typescript not identify it as a undefined

* add T State to depend on ValidationArgs

Make ValidationArgs without parameters 
Make sure that the state has every key in the validation to ensure correct state parameters

* revert Validation Args type

* revert ValidationArgs to default
  • Loading branch information
A-Ghorab authored Mar 28, 2022
1 parent 588707f commit 2c1f83e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vuelidate/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export type ValidationRule <T = any> = ValidationRuleWithParams<any, T> | Valida
export type ValidationRuleCollection <T = any> = Record<string, ValidationRule<T>>;

export type ValidationArgs<T = unknown> = {
[key in keyof T]?: ValidationArgs<T[key]> | ValidationRuleCollection<typeof T[key]> | ValidationRule<typeof T[key]>
[key in keyof T]: ValidationArgs<T[key]> | ValidationRuleCollection<typeof T[key]> | ValidationRule<typeof T[key]>
}

export interface RuleResultWithoutParams {
Expand Down Expand Up @@ -179,8 +179,8 @@ export interface GlobalConfig {

export function useVuelidate(globalConfig?: GlobalConfig): Ref<Validation>;
export function useVuelidate<
T extends Object,
Vargs extends ValidationArgs<T> = ValidationArgs<T>,
T extends {[key in keyof Vargs]: any},
Vargs extends ValidationArgs = ValidationArgs,
EState extends ExtractState<Vargs> = ExtractState<Vargs>
>(
validationsArgs: Ref<Vargs> | Vargs,
Expand Down

0 comments on commit 2c1f83e

Please sign in to comment.