@types/react-hooks-helper: new types for useForm function (#34816)

* feat: react hooks helper types

* fix: react hooks helper test

* fix: removed module declaration

* fix: semicolons

* fix: click function typo

* fix: codeowners info

* fix: export module to umd

* feat: added types for useForm function

* fix: linting errors
This commit is contained in:
João Edmundo
2019-04-18 16:23:58 -07:00
committed by Armando Aguirre
parent 92933e1ddd
commit 03186dbc08
+17 -2
View File
@@ -4,6 +4,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/// <reference types="react"/>
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<HTMLInputElement> | React.ChangeEvent<HTMLInputElement>) => void;
export type ChangeForm = (value: FormTarget) => any;
export type SetForm = ChangeForm & InputChange;
export function useForm<T>(defaultFormConfig: T): [T, SetForm];