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

#4181 #4553

Merged
merged 2 commits into from
Nov 23, 2023
Merged

#4181 #4553

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion packages/vee-validate/src/Field.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { h, defineComponent, toRef, SetupContext, resolveDynamicComponent, computed, PropType, VNode } from 'vue';
import {
h,
defineComponent,
toRef,
SetupContext,
resolveDynamicComponent,
computed,
PropType,
VNode,
UnwrapRef,
} from 'vue';
import { getConfig } from './config';
import { RuleExpression, useField } from './useField';
import { normalizeChildren, hasCheckedAttr, shouldHaveValueBinding, isPropPresent } from './utils';
Expand Down Expand Up @@ -236,6 +246,10 @@ const FieldImpl = /** #__PURE__ */ defineComponent({
}

ctx.expose({
value,
meta,
errors,
errorMessage,
setErrors,
setTouched,
reset: resetField,
Expand Down Expand Up @@ -296,6 +310,10 @@ function resolveInitialValue(props: Record<string, unknown>, ctx: SetupContext<a

export const Field = FieldImpl as typeof FieldImpl & {
new (): {
value: UnwrapRef<FieldContext['value']>;
meta: UnwrapRef<FieldContext['meta']>;
errors: UnwrapRef<FieldContext['errors']>;
errorMessage: UnwrapRef<FieldContext['errorMessage']>;
setErrors: FieldContext['setErrors'];
setTouched: FieldContext['setTouched'];
reset: FieldContext['resetField'];
Expand Down