Skip to content

Commit

Permalink
fix: exposed component APIs to their TS defs with refs closes #3292
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Apr 27, 2022
1 parent 27a4a67 commit ae59d0f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vee-validate/src/Field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ function resolveInitialValue(props: Record<string, unknown>, ctx: SetupContext<a

export const Field = FieldImpl as typeof FieldImpl & {
new (): {
setErrors: FieldContext['setErrors'];
setTouched: FieldContext['setTouched'];
reset: FieldContext['resetField'];
validate: FieldContext['validate'];
handleChange: FieldContext['handleChange'];
$slots: {
default: (arg: FieldSlotProps<unknown>) => VNode[];
};
Expand Down
7 changes: 7 additions & 0 deletions packages/vee-validate/src/FieldArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ const FieldArrayImpl = defineComponent({

export const FieldArray = FieldArrayImpl as typeof FieldArrayImpl & {
new (): {
push: FieldArrayContext['push'];
remove: FieldArrayContext['remove'];
swap: FieldArrayContext['swap'];
insert: FieldArrayContext['insert'];
update: FieldArrayContext['update'];
replace: FieldArrayContext['replace'];
prepend: FieldArrayContext['prepend'];
$slots: {
default: (arg: UnwrapRef<FieldArrayContext>) => VNode[];
};
Expand Down
9 changes: 9 additions & 0 deletions packages/vee-validate/src/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ const FormImpl = defineComponent({

export const Form = FormImpl as typeof FormImpl & {
new (): {
setFieldError: FormContext['setFieldError'];
setErrors: FormContext['setErrors'];
setFieldValue: FormContext['setFieldValue'];
setValues: FormContext['setValues'];
setFieldTouched: FormContext['setFieldTouched'];
setTouched: FormContext['setTouched'];
resetForm: FormContext['resetForm'];
validate: FormContext['validate'];
validateField: FormContext['validateField'];
$slots: {
default: (arg: FormSlotProps) => VNode[];
};
Expand Down

0 comments on commit ae59d0f

Please sign in to comment.