vee-validate 4.7.4 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,19 +12,32 @@ interface FieldValidationMetaInfo {
12
12
  params?: Record<string, unknown> | unknown[];
13
13
  };
14
14
  }
15
- declare type ValidationRuleFunction<TValue = unknown, TParams = unknown[] | Record<string, unknown>> = (value: TValue, params: TParams, ctx: FieldValidationMetaInfo) => boolean | string | Promise<boolean | string>;
16
- declare type SimpleValidationRuleFunction<TValue = unknown, TParams = unknown[] | Record<string, unknown>> = (value: TValue, params: TParams) => boolean | string | Promise<boolean | string>;
17
- declare type ValidationMessageGenerator = (ctx: FieldValidationMetaInfo) => string;
15
+ type ValidationRuleFunction<TValue = unknown, TParams = unknown[] | Record<string, unknown>> = (value: TValue, params: TParams, ctx: FieldValidationMetaInfo) => boolean | string | Promise<boolean | string>;
16
+ type SimpleValidationRuleFunction<TValue = unknown, TParams = unknown[] | Record<string, unknown>> = (value: TValue, params: TParams) => boolean | string | Promise<boolean | string>;
17
+ type ValidationMessageGenerator = (ctx: FieldValidationMetaInfo) => string;
18
18
 
19
- declare type GenericFormValues = Record<string, unknown>;
19
+ type GenericFormValues = Record<string, any>;
20
20
  interface ValidationResult {
21
21
  errors: string[];
22
22
  valid: boolean;
23
23
  }
24
- declare type YupValidator<TValue = any> = {
25
- validate(value: TValue, options: Record<string, any>): Promise<TValue>;
24
+ interface TypedSchemaError {
25
+ path?: string;
26
+ errors: string[];
27
+ }
28
+ interface TypedSchema<TInput = any, TOutput = TInput> {
29
+ __type: 'VVTypedSchema';
30
+ parse(values: TInput): Promise<{
31
+ value?: TOutput;
32
+ errors: TypedSchemaError[];
33
+ }>;
34
+ cast?(values: Partial<TInput>): TInput;
35
+ }
36
+ type YupSchema<TValues = any> = {
37
+ __isYupSchema__: boolean;
38
+ validate(value: any, options: Record<string, any>): Promise<any>;
26
39
  };
27
- declare type MaybeRef<T> = Ref<T> | T;
40
+ type MaybeRef<T> = Ref<T> | T;
28
41
  interface FieldMeta<TValue> {
29
42
  touched: boolean;
30
43
  dirty: boolean;
@@ -51,7 +64,7 @@ interface FieldState<TValue = unknown> {
51
64
  * silent: do not mutate any field
52
65
  * force: validate all fields and mutate their state
53
66
  */
54
- declare type SchemaValidationMode = 'validated-only' | 'silent' | 'force';
67
+ type SchemaValidationMode = 'validated-only' | 'silent' | 'force';
55
68
  interface ValidationOptions$1 {
56
69
  mode: SchemaValidationMode;
57
70
  }
@@ -100,20 +113,20 @@ interface PrivateFieldContext<TValue = unknown> {
100
113
  setErrors(message: string | string[]): void;
101
114
  setValue(value: TValue): void;
102
115
  }
103
- declare type FieldContext<TValue = unknown> = Omit<PrivateFieldContext<TValue>, 'id' | 'instances'>;
104
- declare type GenericValidateFunction<TValue = unknown> = (value: TValue, ctx: FieldValidationMetaInfo) => boolean | string | Promise<boolean | string>;
116
+ type FieldContext<TValue = unknown> = Omit<PrivateFieldContext<TValue>, 'id' | 'instances'>;
117
+ type GenericValidateFunction<TValue = unknown> = (value: TValue, ctx: FieldValidationMetaInfo) => boolean | string | Promise<boolean | string>;
105
118
  interface FormState<TValues> {
106
119
  values: TValues;
107
120
  errors: Partial<Record<keyof TValues, string | undefined>>;
108
121
  touched: Partial<Record<keyof TValues, boolean>>;
109
122
  submitCount: number;
110
123
  }
111
- declare type FormErrors<TValues extends GenericFormValues> = Partial<Record<keyof TValues, string | undefined>>;
112
- declare type FormErrorBag<TValues extends GenericFormValues> = Partial<Record<keyof TValues, string[]>>;
124
+ type FormErrors<TValues extends GenericFormValues> = Partial<Record<keyof TValues, string | undefined>>;
125
+ type FormErrorBag<TValues extends GenericFormValues> = Partial<Record<keyof TValues, string[]>>;
113
126
  interface SetFieldValueOptions {
114
127
  force: boolean;
115
128
  }
116
- interface FormActions<TValues extends GenericFormValues> {
129
+ interface FormActions<TValues extends GenericFormValues, TOutput extends TValues = TValues> {
117
130
  setFieldValue<T extends keyof TValues>(field: T, value: TValues[T], opts?: Partial<SetFieldValueOptions>): void;
118
131
  setFieldError(field: keyof TValues, message: string | string[] | undefined): void;
119
132
  setErrors(fields: FormErrors<TValues>): void;
@@ -123,43 +136,44 @@ interface FormActions<TValues extends GenericFormValues> {
123
136
  resetForm(state?: Partial<FormState<TValues>>): void;
124
137
  resetField(field: keyof TValues, state?: Partial<FieldState>): void;
125
138
  }
126
- interface FormValidationResult<TValues> {
139
+ interface FormValidationResult<TValues, TOutput = TValues> {
127
140
  valid: boolean;
128
141
  results: Partial<Record<keyof TValues, ValidationResult>>;
129
142
  errors: Partial<Record<keyof TValues, string>>;
143
+ values?: TOutput;
130
144
  }
131
145
  interface SubmissionContext<TValues extends GenericFormValues = GenericFormValues> extends FormActions<TValues> {
132
146
  evt?: Event;
133
147
  controlledValues: Partial<TValues>;
134
148
  }
135
- declare type SubmissionHandler<TValues extends GenericFormValues = GenericFormValues, TReturn = unknown> = (values: TValues, ctx: SubmissionContext<TValues>) => TReturn;
149
+ type SubmissionHandler<TValues extends GenericFormValues = GenericFormValues, TOutput extends TValues = TValues, TReturn = unknown> = (values: TOutput, ctx: SubmissionContext<TValues>) => TReturn;
136
150
  interface InvalidSubmissionContext<TValues extends GenericFormValues = GenericFormValues> {
137
151
  values: TValues;
138
152
  evt?: Event;
139
153
  errors: Partial<Record<keyof TValues, string>>;
140
154
  results: Partial<Record<keyof TValues, ValidationResult>>;
141
155
  }
142
- declare type InvalidSubmissionHandler<TValues extends GenericFormValues = GenericFormValues> = (ctx: InvalidSubmissionContext<TValues>) => void;
143
- declare type RawFormSchema<TValues> = Record<keyof TValues, string | GenericValidateFunction | Record<string, any>>;
144
- declare type FieldPathLookup<TValues extends Record<string, any> = Record<string, any>> = Partial<Record<keyof TValues, PrivateFieldContext | PrivateFieldContext[]>>;
145
- declare type MapValues<T, TValues extends Record<string, any>> = {
156
+ type InvalidSubmissionHandler<TValues extends GenericFormValues = GenericFormValues> = (ctx: InvalidSubmissionContext<TValues>) => void;
157
+ type RawFormSchema<TValues> = Record<keyof TValues, string | GenericValidateFunction | Record<string, any>>;
158
+ type FieldPathLookup<TValues extends Record<string, any> = Record<string, any>> = Partial<Record<keyof TValues, PrivateFieldContext | PrivateFieldContext[]>>;
159
+ type MapValues<T, TValues extends Record<string, any>> = {
146
160
  [K in keyof T]: T[K] extends MaybeRef<infer TKey> ? TKey extends keyof TValues ? Ref<TValues[TKey]> : Ref<unknown> : Ref<unknown>;
147
161
  };
148
- declare type HandleSubmitFactory<TValues extends GenericFormValues> = <TReturn = unknown>(cb: SubmissionHandler<TValues, TReturn>, onSubmitValidationErrorCb?: InvalidSubmissionHandler<TValues>) => (e?: Event) => Promise<TReturn | undefined>;
149
- interface PrivateFormContext<TValues extends Record<string, any> = Record<string, any>> extends FormActions<TValues> {
162
+ type HandleSubmitFactory<TValues extends GenericFormValues, TOutput extends TValues = TValues> = <TReturn = unknown>(cb: SubmissionHandler<TValues, TOutput, TReturn>, onSubmitValidationErrorCb?: InvalidSubmissionHandler<TValues>) => (e?: Event) => Promise<TReturn | undefined>;
163
+ interface PrivateFormContext<TValues extends GenericFormValues = GenericFormValues, TOutput extends TValues = TValues> extends FormActions<TValues> {
150
164
  formId: number;
151
165
  values: TValues;
152
166
  controlledValues: Ref<TValues>;
153
167
  fieldsByPath: Ref<FieldPathLookup>;
154
168
  fieldArrays: PrivateFieldArrayContext[];
155
169
  submitCount: Ref<number>;
156
- schema?: MaybeRef<RawFormSchema<TValues> | YupValidator<TValues> | undefined>;
170
+ schema?: MaybeRef<RawFormSchema<TValues> | TypedSchema<TValues, TOutput> | YupSchema<TValues> | undefined>;
157
171
  errorBag: Ref<FormErrorBag<TValues>>;
158
172
  errors: ComputedRef<FormErrors<TValues>>;
159
173
  meta: ComputedRef<FormMeta<TValues>>;
160
174
  isSubmitting: Ref<boolean>;
161
175
  keepValuesOnUnmount: MaybeRef<boolean>;
162
- validateSchema?: (mode: SchemaValidationMode) => Promise<FormValidationResult<TValues>>;
176
+ validateSchema?: (mode: SchemaValidationMode) => Promise<FormValidationResult<TValues, TOutput>>;
163
177
  validate(opts?: Partial<ValidationOptions$1>): Promise<FormValidationResult<TValues>>;
164
178
  validateField(field: keyof TValues): Promise<ValidationResult>;
165
179
  setFieldErrorBag(field: string, messages: string | string[]): void;
@@ -167,14 +181,14 @@ interface PrivateFormContext<TValues extends Record<string, any> = Record<string
167
181
  unsetInitialValue(path: string): void;
168
182
  register(field: PrivateFieldContext): void;
169
183
  unregister(field: PrivateFieldContext): void;
170
- handleSubmit: HandleSubmitFactory<TValues> & {
171
- withControlled: HandleSubmitFactory<TValues>;
184
+ handleSubmit: HandleSubmitFactory<TValues, TOutput> & {
185
+ withControlled: HandleSubmitFactory<TValues, TOutput>;
172
186
  };
173
187
  setFieldInitialValue(path: string, value: unknown): void;
174
188
  useFieldModel<TPath extends keyof TValues>(path: MaybeRef<TPath>): Ref<TValues[TPath]>;
175
189
  useFieldModel<TPath extends keyof TValues>(paths: [...MaybeRef<TPath>[]]): MapValues<typeof paths, TValues>;
176
190
  }
177
- interface FormContext<TValues extends Record<string, any> = Record<string, any>> extends Omit<PrivateFormContext<TValues>, 'formId' | 'register' | 'unregister' | 'fieldsByPath' | 'schema' | 'validateSchema' | 'errorBag' | 'setFieldErrorBag' | 'stageInitialValue' | 'setFieldInitialValue' | 'unsetInitialValue' | 'fieldArrays' | 'keepValuesOnUnmount'> {
191
+ interface FormContext<TValues extends Record<string, any> = Record<string, any>, TOutput extends TValues = TValues> extends Omit<PrivateFormContext<TValues, TOutput>, 'formId' | 'register' | 'unregister' | 'fieldsByPath' | 'schema' | 'validateSchema' | 'setFieldErrorBag' | 'stageInitialValue' | 'setFieldInitialValue' | 'unsetInitialValue' | 'fieldArrays' | 'keepValuesOnUnmount'> {
178
192
  handleReset: () => void;
179
193
  submitForm: (e?: unknown) => Promise<void>;
180
194
  }
@@ -188,7 +202,14 @@ interface ValidationOptions {
188
202
  /**
189
203
  * Validates a value against the rules.
190
204
  */
191
- declare function validate<TValue = unknown>(value: TValue, rules: string | Record<string, unknown | unknown[]> | GenericValidateFunction<TValue> | GenericValidateFunction<TValue>[] | YupValidator, options?: ValidationOptions): Promise<ValidationResult>;
205
+ declare function validate<TValue = unknown>(value: TValue, rules: string | Record<string, unknown | unknown[]> | GenericValidateFunction<TValue> | GenericValidateFunction<TValue>[] | TypedSchema<TValue>, options?: ValidationOptions): Promise<ValidationResult>;
206
+ declare function validateObjectSchema<TValues, TOutput>(schema: RawFormSchema<TValues>, values: TValues, opts?: Partial<{
207
+ names: Record<string, {
208
+ name: string;
209
+ label: string;
210
+ }>;
211
+ bailsMap: Record<string, boolean>;
212
+ }>): Promise<FormValidationResult<TValues, TOutput>>;
192
213
 
193
214
  /**
194
215
  * Adds a custom validator to the list of validation rules.
@@ -222,7 +243,7 @@ interface FieldOptions<TValue = unknown> {
222
243
  syncVModel?: boolean;
223
244
  form?: FormContext;
224
245
  }
225
- declare type RuleExpression<TValue> = string | Record<string, unknown> | GenericValidateFunction<TValue> | GenericValidateFunction<TValue>[] | YupValidator<TValue> | undefined;
246
+ type RuleExpression<TValue> = string | Record<string, unknown> | GenericValidateFunction<TValue> | GenericValidateFunction<TValue>[] | TypedSchema<TValue> | YupSchema<TValue> | undefined;
226
247
  /**
227
248
  * Creates a field composite.
228
249
  */
@@ -312,7 +333,7 @@ declare const Field: {
312
333
  };
313
334
  modelValue: {
314
335
  type: any;
315
- default: symbol;
336
+ default: any;
316
337
  };
317
338
  modelModifiers: {
318
339
  type: any;
@@ -340,8 +361,8 @@ declare const Field: {
340
361
  $slots: Readonly<{
341
362
  [name: string]: vue.Slot;
342
363
  }>;
343
- $root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
344
- $parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
364
+ $root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>;
365
+ $parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>;
345
366
  $emit: (event: string, ...args: any[]) => void;
346
367
  $el: any;
347
368
  $options: vue.ComponentOptionsBase<Readonly<vue.ExtractPropTypes<{
@@ -391,7 +412,7 @@ declare const Field: {
391
412
  };
392
413
  modelValue: {
393
414
  type: any;
394
- default: symbol;
415
+ default: any;
395
416
  };
396
417
  modelModifiers: {
397
418
  type: any;
@@ -433,7 +454,7 @@ declare const Field: {
433
454
  rules: RuleExpression<unknown>;
434
455
  'onUpdate:modelValue': (e: any) => unknown;
435
456
  keepValue: boolean;
436
- }> & {
457
+ }, {}, string> & {
437
458
  beforeCreate?: (() => void) | (() => void)[];
438
459
  created?: (() => void) | (() => void)[];
439
460
  beforeMount?: (() => void) | (() => void)[];
@@ -448,11 +469,11 @@ declare const Field: {
448
469
  unmounted?: (() => void) | (() => void)[];
449
470
  renderTracked?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
450
471
  renderTriggered?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
451
- errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void)[];
472
+ errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>, info: string) => boolean | void)[];
452
473
  };
453
474
  $forceUpdate: () => void;
454
475
  $nextTick: typeof vue.nextTick;
455
- $watch(source: string | Function, cb: Function, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
476
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
456
477
  } & Readonly<vue.ExtractPropTypes<{
457
478
  as: {
458
479
  type: (ObjectConstructor | StringConstructor)[];
@@ -500,7 +521,7 @@ declare const Field: {
500
521
  };
501
522
  modelValue: {
502
523
  type: any;
503
- default: symbol;
524
+ default: any;
504
525
  };
505
526
  modelModifiers: {
506
527
  type: any;
@@ -526,7 +547,7 @@ declare const Field: {
526
547
  default: () => VNode<vue.RendererNode, vue.RendererElement, {
527
548
  [key: string]: any;
528
549
  }>[];
529
- }> & {} & vue.ComponentCustomProperties;
550
+ }> & {} & vue.ComponentCustomProperties & {};
530
551
  __isFragment?: never;
531
552
  __isTeleport?: never;
532
553
  __isSuspense?: never;
@@ -577,7 +598,7 @@ declare const Field: {
577
598
  };
578
599
  modelValue: {
579
600
  type: any;
580
- default: symbol;
601
+ default: any;
581
602
  };
582
603
  modelModifiers: {
583
604
  type: any;
@@ -619,7 +640,7 @@ declare const Field: {
619
640
  rules: RuleExpression<unknown>;
620
641
  'onUpdate:modelValue': (e: any) => unknown;
621
642
  keepValue: boolean;
622
- }> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
643
+ }, {}, string> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
623
644
  setErrors: FieldContext['setErrors'];
624
645
  setTouched: FieldContext['setTouched'];
625
646
  reset: FieldContext['resetField'];
@@ -630,7 +651,7 @@ declare const Field: {
630
651
  };
631
652
  });
632
653
 
633
- declare type FormSlotProps = UnwrapRef<Pick<FormContext, 'meta' | 'errors' | 'values' | 'isSubmitting' | 'submitCount' | 'validate' | 'validateField' | 'handleReset' | 'setErrors' | 'setFieldError' | 'setFieldValue' | 'setValues' | 'setFieldTouched' | 'setTouched' | 'resetForm' | 'resetField' | 'controlledValues'>> & {
654
+ type FormSlotProps = UnwrapRef<Pick<FormContext, 'meta' | 'errors' | 'values' | 'isSubmitting' | 'submitCount' | 'validate' | 'validateField' | 'handleReset' | 'setErrors' | 'setFieldError' | 'setFieldValue' | 'setValues' | 'setFieldTouched' | 'setTouched' | 'resetForm' | 'resetField' | 'controlledValues'>> & {
634
655
  handleSubmit: (evt: Event | SubmissionHandler, onSubmit?: SubmissionHandler) => Promise<unknown>;
635
656
  submitForm(evt?: Event): void;
636
657
  getValues<TValues extends GenericFormValues = GenericFormValues>(): TValues;
@@ -642,7 +663,7 @@ declare const Form: {
642
663
  $: vue.ComponentInternalInstance;
643
664
  $data: {};
644
665
  $props: Partial<{
645
- onSubmit: SubmissionHandler<GenericFormValues, unknown>;
666
+ onSubmit: SubmissionHandler<GenericFormValues, GenericFormValues, unknown>;
646
667
  as: string;
647
668
  initialValues: Record<string, any>;
648
669
  validateOnMount: boolean;
@@ -677,7 +698,7 @@ declare const Form: {
677
698
  default: boolean;
678
699
  };
679
700
  onSubmit: {
680
- type: PropType<SubmissionHandler<GenericFormValues, unknown>>;
701
+ type: PropType<SubmissionHandler<GenericFormValues, GenericFormValues, unknown>>;
681
702
  default: any;
682
703
  };
683
704
  onInvalidSubmit: {
@@ -698,8 +719,8 @@ declare const Form: {
698
719
  $slots: Readonly<{
699
720
  [name: string]: vue.Slot;
700
721
  }>;
701
- $root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
702
- $parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
722
+ $root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>;
723
+ $parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>;
703
724
  $emit: (event: string, ...args: any[]) => void;
704
725
  $el: any;
705
726
  $options: vue.ComponentOptionsBase<Readonly<vue.ExtractPropTypes<{
@@ -728,7 +749,7 @@ declare const Form: {
728
749
  default: boolean;
729
750
  };
730
751
  onSubmit: {
731
- type: PropType<SubmissionHandler<GenericFormValues, unknown>>;
752
+ type: PropType<SubmissionHandler<GenericFormValues, GenericFormValues, unknown>>;
732
753
  default: any;
733
754
  };
734
755
  onInvalidSubmit: {
@@ -748,7 +769,7 @@ declare const Form: {
748
769
  [key: string]: any;
749
770
  }>[];
750
771
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {
751
- onSubmit: SubmissionHandler<GenericFormValues, unknown>;
772
+ onSubmit: SubmissionHandler<GenericFormValues, GenericFormValues, unknown>;
752
773
  as: string;
753
774
  initialValues: Record<string, any>;
754
775
  validateOnMount: boolean;
@@ -757,7 +778,7 @@ declare const Form: {
757
778
  initialTouched: Record<string, any>;
758
779
  onInvalidSubmit: InvalidSubmissionHandler<GenericFormValues>;
759
780
  keepValues: boolean;
760
- }> & {
781
+ }, {}, string> & {
761
782
  beforeCreate?: (() => void) | (() => void)[];
762
783
  created?: (() => void) | (() => void)[];
763
784
  beforeMount?: (() => void) | (() => void)[];
@@ -772,11 +793,11 @@ declare const Form: {
772
793
  unmounted?: (() => void) | (() => void)[];
773
794
  renderTracked?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
774
795
  renderTriggered?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
775
- errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void)[];
796
+ errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>, info: string) => boolean | void)[];
776
797
  };
777
798
  $forceUpdate: () => void;
778
799
  $nextTick: typeof vue.nextTick;
779
- $watch(source: string | Function, cb: Function, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
800
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
780
801
  } & Readonly<vue.ExtractPropTypes<{
781
802
  as: {
782
803
  type: StringConstructor;
@@ -803,7 +824,7 @@ declare const Form: {
803
824
  default: boolean;
804
825
  };
805
826
  onSubmit: {
806
- type: PropType<SubmissionHandler<GenericFormValues, unknown>>;
827
+ type: PropType<SubmissionHandler<GenericFormValues, GenericFormValues, unknown>>;
807
828
  default: any;
808
829
  };
809
830
  onInvalidSubmit: {
@@ -822,7 +843,7 @@ declare const Form: {
822
843
  default: () => VNode<vue.RendererNode, vue.RendererElement, {
823
844
  [key: string]: any;
824
845
  }>[];
825
- }> & {} & vue.ComponentCustomProperties;
846
+ }> & {} & vue.ComponentCustomProperties & {};
826
847
  __isFragment?: never;
827
848
  __isTeleport?: never;
828
849
  __isSuspense?: never;
@@ -852,7 +873,7 @@ declare const Form: {
852
873
  default: boolean;
853
874
  };
854
875
  onSubmit: {
855
- type: PropType<SubmissionHandler<GenericFormValues, unknown>>;
876
+ type: PropType<SubmissionHandler<GenericFormValues, GenericFormValues, unknown>>;
856
877
  default: any;
857
878
  };
858
879
  onInvalidSubmit: {
@@ -872,7 +893,7 @@ declare const Form: {
872
893
  [key: string]: any;
873
894
  }>[];
874
895
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {
875
- onSubmit: SubmissionHandler<GenericFormValues, unknown>;
896
+ onSubmit: SubmissionHandler<GenericFormValues, GenericFormValues, unknown>;
876
897
  as: string;
877
898
  initialValues: Record<string, any>;
878
899
  validateOnMount: boolean;
@@ -881,7 +902,7 @@ declare const Form: {
881
902
  initialTouched: Record<string, any>;
882
903
  onInvalidSubmit: InvalidSubmissionHandler<GenericFormValues>;
883
904
  keepValues: boolean;
884
- }> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
905
+ }, {}, string> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
885
906
  setFieldError: FormContext['setFieldError'];
886
907
  setErrors: FormContext['setErrors'];
887
908
  setFieldValue: FormContext['setFieldValue'];
@@ -919,8 +940,8 @@ declare const FieldArray: {
919
940
  $slots: Readonly<{
920
941
  [name: string]: vue.Slot;
921
942
  }>;
922
- $root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
923
- $parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
943
+ $root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>;
944
+ $parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>;
924
945
  $emit: (event: string, ...args: any[]) => void;
925
946
  $el: any;
926
947
  $options: vue.ComponentOptionsBase<Readonly<vue.ExtractPropTypes<{
@@ -934,7 +955,7 @@ declare const FieldArray: {
934
955
  default: () => VNode<vue.RendererNode, vue.RendererElement, {
935
956
  [key: string]: any;
936
957
  }>[];
937
- }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}> & {
958
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}, {}, string> & {
938
959
  beforeCreate?: (() => void) | (() => void)[];
939
960
  created?: (() => void) | (() => void)[];
940
961
  beforeMount?: (() => void) | (() => void)[];
@@ -949,11 +970,11 @@ declare const FieldArray: {
949
970
  unmounted?: (() => void) | (() => void)[];
950
971
  renderTracked?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
951
972
  renderTriggered?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
952
- errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void)[];
973
+ errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>, info: string) => boolean | void)[];
953
974
  };
954
975
  $forceUpdate: () => void;
955
976
  $nextTick: typeof vue.nextTick;
956
- $watch(source: string | Function, cb: Function, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
977
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
957
978
  } & Readonly<vue.ExtractPropTypes<{
958
979
  name: {
959
980
  type: StringConstructor;
@@ -965,7 +986,7 @@ declare const FieldArray: {
965
986
  default: () => VNode<vue.RendererNode, vue.RendererElement, {
966
987
  [key: string]: any;
967
988
  }>[];
968
- }> & {} & vue.ComponentCustomProperties;
989
+ }> & {} & vue.ComponentCustomProperties & {};
969
990
  __isFragment?: never;
970
991
  __isTeleport?: never;
971
992
  __isSuspense?: never;
@@ -980,7 +1001,7 @@ declare const FieldArray: {
980
1001
  default: () => VNode<vue.RendererNode, vue.RendererElement, {
981
1002
  [key: string]: any;
982
1003
  }>[];
983
- }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1004
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}, {}, string> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
984
1005
  push: FieldArrayContext['push'];
985
1006
  remove: FieldArrayContext['remove'];
986
1007
  swap: FieldArrayContext['swap'];
@@ -1022,8 +1043,8 @@ declare const ErrorMessage: {
1022
1043
  $slots: Readonly<{
1023
1044
  [name: string]: vue.Slot;
1024
1045
  }>;
1025
- $root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
1026
- $parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
1046
+ $root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>;
1047
+ $parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>;
1027
1048
  $emit: (event: string, ...args: any[]) => void;
1028
1049
  $el: any;
1029
1050
  $options: vue.ComponentOptionsBase<Readonly<vue.ExtractPropTypes<{
@@ -1045,7 +1066,7 @@ declare const ErrorMessage: {
1045
1066
  }>[];
1046
1067
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {
1047
1068
  as: string;
1048
- }> & {
1069
+ }, {}, string> & {
1049
1070
  beforeCreate?: (() => void) | (() => void)[];
1050
1071
  created?: (() => void) | (() => void)[];
1051
1072
  beforeMount?: (() => void) | (() => void)[];
@@ -1060,11 +1081,11 @@ declare const ErrorMessage: {
1060
1081
  unmounted?: (() => void) | (() => void)[];
1061
1082
  renderTracked?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
1062
1083
  renderTriggered?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
1063
- errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void)[];
1084
+ errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>, info: string) => boolean | void)[];
1064
1085
  };
1065
1086
  $forceUpdate: () => void;
1066
1087
  $nextTick: typeof vue.nextTick;
1067
- $watch(source: string | Function, cb: Function, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
1088
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
1068
1089
  } & Readonly<vue.ExtractPropTypes<{
1069
1090
  as: {
1070
1091
  type: StringConstructor;
@@ -1082,7 +1103,7 @@ declare const ErrorMessage: {
1082
1103
  default: () => VNode<vue.RendererNode, vue.RendererElement, {
1083
1104
  [key: string]: any;
1084
1105
  }>[];
1085
- }> & {} & vue.ComponentCustomProperties;
1106
+ }> & {} & vue.ComponentCustomProperties & {};
1086
1107
  __isFragment?: never;
1087
1108
  __isTeleport?: never;
1088
1109
  __isSuspense?: never;
@@ -1105,21 +1126,22 @@ declare const ErrorMessage: {
1105
1126
  }>[];
1106
1127
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {
1107
1128
  as: string;
1108
- }> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1129
+ }, {}, string> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1109
1130
  $slots: {
1110
1131
  default: (arg: ErrorMessageSlotProps) => VNode[];
1111
1132
  };
1112
1133
  });
1113
1134
 
1114
- interface FormOptions<TValues extends Record<string, any>> {
1115
- validationSchema?: MaybeRef<Record<keyof TValues, GenericValidateFunction | string | Record<string, any>> | any | undefined>;
1135
+ type FormSchema<TValues> = Record<keyof TValues, GenericValidateFunction | string | GenericFormValues> | undefined;
1136
+ interface FormOptions<TValues extends GenericFormValues, TOutput extends TValues = TValues, TSchema extends TypedSchema<TValues, TOutput> | FormSchema<TValues> = FormSchema<TValues> | TypedSchema<TValues, TOutput>> {
1137
+ validationSchema?: MaybeRef<TSchema extends TypedSchema ? TypedSchema<TValues, TOutput> : any>;
1116
1138
  initialValues?: MaybeRef<TValues>;
1117
1139
  initialErrors?: Record<keyof TValues, string | undefined>;
1118
1140
  initialTouched?: Record<keyof TValues, boolean>;
1119
1141
  validateOnMount?: boolean;
1120
1142
  keepValuesOnUnmount?: MaybeRef<boolean>;
1121
1143
  }
1122
- declare function useForm<TValues extends Record<string, any> = Record<string, any>>(opts?: FormOptions<TValues>): FormContext<TValues>;
1144
+ declare function useForm<TValues extends GenericFormValues = GenericFormValues, TOutput extends TValues = TValues, TSchema extends FormSchema<TValues> | TypedSchema<TValues, TOutput> = FormSchema<TValues> | TypedSchema<TValues, TOutput>>(opts?: FormOptions<TValues, TOutput, TSchema>): FormContext<TValues, TOutput>;
1123
1145
 
1124
1146
  declare function useFieldArray<TValue = unknown>(arrayPath: MaybeRef<string>): FieldArrayContext<TValue>;
1125
1147
 
@@ -1199,6 +1221,6 @@ declare function useSubmitForm<TValues extends Record<string, unknown> = Record<
1199
1221
 
1200
1222
  declare const FormContextKey: InjectionKey<PrivateFormContext>;
1201
1223
  declare const FieldContextKey: InjectionKey<PrivateFieldContext<unknown>>;
1202
- declare const IS_ABSENT: unique symbol;
1224
+ declare const IS_ABSENT: any;
1203
1225
 
1204
- export { ErrorMessage, Field, FieldArray, FieldArrayContext, FieldContext, FieldContextKey, FieldEntry, FieldMeta, FieldOptions, Form, FormActions, FormContext, FormContextKey, FormMeta, FormOptions, FormState, FormValidationResult, GenericValidateFunction, IS_ABSENT, InvalidSubmissionContext, InvalidSubmissionHandler, RuleExpression, SubmissionContext, SubmissionHandler, ValidationOptions$1 as ValidationOptions, ValidationResult, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate };
1226
+ export { ErrorMessage, Field, FieldArray, FieldArrayContext, FieldContext, FieldContextKey, FieldEntry, FieldMeta, FieldOptions, FieldState, Form, FormActions, FormContext, FormContextKey, FormMeta, FormOptions, FormState, FormValidationResult, GenericValidateFunction, IS_ABSENT, InvalidSubmissionContext, InvalidSubmissionHandler, RawFormSchema, RuleExpression, SubmissionContext, SubmissionHandler, TypedSchema, TypedSchemaError, ValidationOptions$1 as ValidationOptions, ValidationResult, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };