@roqueform/react
Version:
Hooks and components to integrate Roqueform with React.
39 lines (38 loc) • 1.52 kB
TypeScript
import { Field, PluginInjector } from 'roqueform';
type NoInfer<T> = [T][T extends any ? 0 : never];
/**
* Creates the new field.
*
* @returns The {@link Field} instance.
* @template Value The root field value.
*/
export declare function useField<Value = any>(): Field<Value | undefined>;
/**
* Creates the new field.
*
* @param initialValue The initial value assigned to the field.
* @returns The {@link Field} instance.
* @template Value The root field value.
*/
export declare function useField<Value>(initialValue: Value | (() => Value)): Field<Value>;
/**
* Creates the new field enhanced by a plugin.
*
* @param initialValue The initial value assigned to the field.
* @param plugin The plugin injector that enhances the field.
* @returns The {@link Field} instance.
* @template Value The root field value.
* @template Plugin The plugin injected into the field.
*/
export declare function useField<Value, Plugin>(initialValue: Value | (() => Value), plugin: PluginInjector<Plugin>): Field<Value, Plugin>;
/**
* Creates the new field enhanced by a plugin.
*
* @param initialValue The initial value assigned to the field.
* @param plugin The plugin injector that enhances the field.
* @returns The {@link Field} instance.
* @template Value The root field value.
* @template Plugin The plugin injected into the field.
*/
export declare function useField<Value, Plugin>(initialValue: Value | (() => Value), plugin: PluginInjector<Plugin, NoInfer<Value>>): Field<Value, Plugin>;
export {};