import { type ReactNode } from 'react'; import type { Control, FieldPath, FieldPathValue, FieldValues } from './types'; type GetValues[] = readonly []> = TFieldNames extends readonly [ infer Name extends FieldPath, ...infer RestFieldNames ] ? RestFieldNames extends readonly FieldPath[] ? readonly [ FieldPathValue, ...GetValues ] : never : TFieldNames extends readonly [infer Name extends FieldPath] ? readonly [FieldPathValue] : TFieldNames extends readonly [] ? readonly [] : never; export type WatchProps[], TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = { control: Control; names: TFieldNames; render: (values: GetValues) => ReactNode; }; /** * Watch component that subscribes to form field changes and re-renders when watched fields update. * * @param control - The form control object from useForm * @param names - Array of field names to watch for changes * @param render - The function that receives watched values and returns ReactNode * @returns The result of calling render function with watched values * * @example * The `Watch` component only re-render when the values of `foo`, `bar`, and `baz.qux` change. * The types of `foo`, `bar`, and `baz.qux` are precisely inferred. * * ```tsx * const { control } = useForm(); * *
{foo}{bar}{baz_qux}
} * /> * ``` */ export declare const Watch: [], TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>({ control, names, render, }: WatchProps) => ReactNode; export {}; //# sourceMappingURL=watch.d.ts.map