import type { InjectionKey } from '@vue/runtime-core'; import type { HandleSubmit } from './types/HandleSubmit'; import type { ReadonlyRef } from './types/ReadonlyRef'; import type { SetFieldTouched } from './types/SetFieldTouched'; import type { SetFieldValue } from './types/SetFieldValue'; import type { SetHasSubmitted } from './types/SetHasSubmitted'; import type { SetSubmitting } from './types/SetSubmitting'; import { SetTouched } from './types/SetTouched'; import type { SetValues } from './types/SetValues'; import type { TouchedOf } from './types/TouchedOf'; import type { ValidationResult } from './types/ValidationResult'; const injectionKeys = { values: Symbol('values'), setValues: Symbol('setValues'), setFieldValue: Symbol('setFieldValue'), touched: Symbol('touched'), setTouched: Symbol('setTouched'), setFieldTouched: Symbol('setFieldTouched'), errors: Symbol('errors'), isSubmitting: Symbol('isSubmitting'), setSubmitting: Symbol('setSubmitting'), hasSubmitted: Symbol('hasSubmitted'), setHasSubmitted: Symbol('setHasSubmitted'), validate: Symbol('validate'), handleSubmit: Symbol('handleSubmit'), }; export const getInjectionKeys = () => ({ values: injectionKeys.values as InjectionKey>, setValues: injectionKeys.setValues as InjectionKey>, setFieldValue: injectionKeys.setFieldValue as InjectionKey, touched: injectionKeys.touched as InjectionKey< ReadonlyRef> >, setTouched: injectionKeys.setTouched as InjectionKey>, setFieldTouched: injectionKeys.setFieldTouched as InjectionKey< SetFieldTouched >, errors: injectionKeys.errors as InjectionKey< ReadonlyRef> >, isSubmitting: injectionKeys.isSubmitting as InjectionKey< ReadonlyRef >, setSubmitting: injectionKeys.setSubmitting as InjectionKey, hasSubmitted: injectionKeys.hasSubmitted as InjectionKey< ReadonlyRef >, setHasSubmitted: injectionKeys.setHasSubmitted as InjectionKey< SetHasSubmitted >, validate: injectionKeys.validate as InjectionKey<() => void>, handleSubmit: injectionKeys.handleSubmit as InjectionKey< HandleSubmit >, });