diff --git a/types/react-hooks-helper/index.d.ts b/types/react-hooks-helper/index.d.ts index fe8a1b4693..9c4a31f628 100644 --- a/types/react-hooks-helper/index.d.ts +++ b/types/react-hooks-helper/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 +/// + export as namespace ReactHooksHelper; export interface NavigationProps { @@ -30,6 +32,19 @@ export interface UseStepResponse { export function useStep(params: UseStepParams): UseStepResponse; -export type UseFormResponse = [any, any]; +export interface FormTarget { + target: { + name: string, // object property name or Dot separated when hierarchical + value: any, + type?: string, + checked?: boolean, + }; +} -export function useForm(params: any): UseFormResponse; +export type InputChange = (event: React.SyntheticEvent | React.ChangeEvent) => void; + +export type ChangeForm = (value: FormTarget) => any; + +export type SetForm = ChangeForm & InputChange; + +export function useForm(defaultFormConfig: T): [T, SetForm];