@modular-forms/react
Version:
The modular and type-safe form library for React
41 lines (40 loc) • 1.85 kB
TypeScript
import type { FieldArrayPath, FieldArrayPathValue, FieldPath, FieldValues, FormStore, Maybe, PartialValues, ResponseData } from '../types';
/**
* Value type of the get values options.
*/
export type GetValuesOptions = Partial<{
shouldActive: boolean;
shouldTouched: boolean;
shouldDirty: boolean;
shouldValid: boolean;
peek: boolean;
}>;
/**
* Returns the current values of the form fields.
*
* @param form The form of the fields.
* @param options The values options.
*
* @returns The form field values.
*/
export declare function getValues<TFieldValues extends FieldValues, TResponseData extends ResponseData>(form: FormStore<TFieldValues, TResponseData>, options?: Maybe<GetValuesOptions>): PartialValues<TFieldValues>;
/**
* Returns the values of the specified field array.
*
* @param form The form of the field array.
* @param name The name of the field array.
* @param options The values options.
*
* @returns The field array values.
*/
export declare function getValues<TFieldValues extends FieldValues, TResponseData extends ResponseData, TFieldArrayName extends FieldArrayPath<TFieldValues>>(form: FormStore<TFieldValues, TResponseData>, name: TFieldArrayName, options?: Maybe<GetValuesOptions>): PartialValues<FieldArrayPathValue<TFieldValues, TFieldArrayName>>;
/**
* Returns the current values of the specified fields and field arrays.
*
* @param form The form of the fields.
* @param names The names of the fields and field arrays.
* @param options The values options.
*
* @returns The form field values.
*/
export declare function getValues<TFieldValues extends FieldValues, TResponseData extends ResponseData>(form: FormStore<TFieldValues, TResponseData>, names: (FieldPath<TFieldValues> | FieldArrayPath<TFieldValues>)[], options?: Maybe<GetValuesOptions>): PartialValues<TFieldValues>;