18 lines
544 B
TypeScript
18 lines
544 B
TypeScript
export interface Options<T> {
|
|
defaultValue?: T;
|
|
defaultValuePropName?: string;
|
|
valuePropName?: string;
|
|
trigger?: string;
|
|
}
|
|
export interface Props {
|
|
[key: string]: any;
|
|
}
|
|
interface StandardProps<T> {
|
|
value: T;
|
|
defaultValue?: T;
|
|
onChange: (val: T) => void;
|
|
}
|
|
declare function useControllableValue<T = any>(props: StandardProps<T>): [T, (val: T) => void];
|
|
declare function useControllableValue<T = any>(props?: Props, options?: Options<T>): [T, (v: T, ...args: any[]) => void];
|
|
export default useControllableValue;
|