import { RefCallback } from "react"; //#region ../../node_modules/.pnpm/react-hook-form@7.75.0_react@19.2.6/node_modules/react-hook-form/dist/types/path/common.d.ts /** * Type to query whether an array type T is a tuple type. * @typeParam T - type which may be an array or tuple * @example * ``` * IsTuple<[number]> = true * IsTuple = false * ``` */ type IsTuple> = number extends T['length'] ? false : true; /** * Type which can be used to index an array or tuple type. */ type ArrayKey = number; /** * Type which given a tuple type returns its own keys, i.e. only its indices. * @typeParam T - tuple type * @example * ``` * TupleKeys<[number, string]> = '0' | '1' * ``` */ type TupleKeys> = Exclude; //#endregion //#region ../../node_modules/.pnpm/react-hook-form@7.75.0_react@19.2.6/node_modules/react-hook-form/dist/types/path/eager.d.ts /** * Helper function to break apart T1 and check if any are equal to T2 * * See {@link IsEqual} */ type AnyIsEqual = T1 extends T2 ? IsEqual extends true ? true : never : never; /** * Helper type for recursively constructing paths through a type. * This actually constructs the strings and recurses into nested * object types. * * See {@link Path} */ type PathImpl = V extends Primitive | BrowserNativeObject ? `${K}` : true extends AnyIsEqual ? `${K}` : `${K}` | `${K}.${PathInternal}`; /** * Helper type for recursively constructing paths through a type. * This obscures the internal type param TraversedTypes from exported contract. * * See {@link Path} */ type PathInternal = T extends ReadonlyArray ? IsTuple extends true ? { [K in TupleKeys]-?: PathImpl }[TupleKeys] : PathImpl : { [K in keyof T]-?: PathImpl }[keyof T]; /** * Type which eagerly collects all paths through a type * @typeParam T - type which should be introspected * @example * ``` * Path<{foo: {bar: string}}> = 'foo' | 'foo.bar' * ``` */ type Path = T extends any ? PathInternal : never; /** * See {@link Path} */ type FieldPath = Path; /** * Helper type for recursively constructing paths through a type. * This actually constructs the strings and recurses into nested * object types. * * See {@link ArrayPath} */ type ArrayPathImpl = V extends Primitive | BrowserNativeObject ? IsAny extends true ? string : never : V extends ReadonlyArray ? U extends Primitive | BrowserNativeObject ? IsAny extends true ? string : never : true extends AnyIsEqual ? never : `${K}` | `${K}.${ArrayPathInternal}` : true extends AnyIsEqual ? never : `${K}.${ArrayPathInternal}`; /** * Helper type for recursively constructing paths through a type. * This obscures the internal type param TraversedTypes from exported contract. * * See {@link ArrayPath} */ type ArrayPathInternal = T extends ReadonlyArray ? IsTuple extends true ? { [K in TupleKeys]-?: ArrayPathImpl }[TupleKeys] : ArrayPathImpl : { [K in keyof T]-?: ArrayPathImpl }[keyof T]; /** * Type which eagerly collects all paths through a type which point to an array * type. * @typeParam T - type which should be introspected. * @example * ``` * Path<{foo: {bar: string[], baz: number[]}}> = 'foo.bar' | 'foo.baz' * ``` */ type ArrayPath = T extends any ? ArrayPathInternal : never; /** * Type to evaluate the type which the given path points to. * @typeParam T - deeply nested type which is indexed by the path * @typeParam P - path into the deeply nested type * @example * ``` * PathValue<{foo: {bar: string}}, 'foo.bar'> = string * PathValue<[number, string], '1'> = string * ``` */ type PathValue | ArrayPath> = PathValueImpl; type PathValueImpl = T extends any ? P extends `${infer K}.${infer R}` ? K extends keyof T ? undefined extends T[K] ? PathValueImpl | undefined : PathValueImpl : K extends `${ArrayKey}` ? T extends ReadonlyArray ? PathValueImpl : never : never : P extends keyof T ? T[P] : P extends `${ArrayKey}` ? T extends ReadonlyArray ? V : T extends undefined ? undefined : never : never : never; /** * See {@link PathValue} */ type FieldPathValue> = PathValue; //#endregion //#region ../../node_modules/.pnpm/react-hook-form@7.75.0_react@19.2.6/node_modules/react-hook-form/dist/types/form.d.ts type ChangeHandler = (event: { target: any; type?: any; }) => Promise; type RefCallBack = (instance: any) => void; type UseFormRegisterReturn = { onChange: ChangeHandler; onBlur: ChangeHandler; ref: RefCallBack; name: TFieldName; min?: string | number; max?: string | number; maxLength?: number; minLength?: number; pattern?: string; required?: boolean; disabled?: boolean; }; /** * Register field into hook form with or without the actual DOM ref. You can invoke register anywhere in the component including at `useEffect`. * * @remarks * [API](https://react-hook-form.com/docs/useform/register) • [Demo](https://codesandbox.io/s/react-hook-form-register-ts-ip2j3) • [Video](https://www.youtube.com/watch?v=JFIpCoajYkA) * * @param name - the path name to the form field value, name is required and unique * @param options - register options include validation, disabled, unregister, value as and dependent validation * * @returns onChange, onBlur, name, ref, and native contribute attribute if browser validation is enabled. * * @example * ```tsx * // Register HTML native input * *