mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
@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:
committed by
Armando Aguirre
parent
92933e1ddd
commit
03186dbc08
Vendored
+17
-2
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user