UNPKG

@modular-forms/react

Version:

The modular and type-safe form library for React

21 lines (20 loc) 806 B
import type { FieldPath, FieldPathValue, FieldValues, FormStore, Maybe, ResponseData } from '../types'; /** * Value type if the get value options. */ export type GetValueOptions = Partial<{ shouldActive: boolean; shouldTouched: boolean; shouldDirty: boolean; shouldValid: boolean; }>; /** * Returns the value of the specified field. * * @param form The form of the field. * @param name The name of the field. * @param options The value options. * * @returns The value of the field. */ export declare function getValue<TFieldValues extends FieldValues, TResponseData extends ResponseData, TFieldName extends FieldPath<TFieldValues>>(form: FormStore<TFieldValues, TResponseData>, name: TFieldName, options?: Maybe<GetValueOptions>): Maybe<FieldPathValue<TFieldValues, TFieldName>>;