fix(striker-ui): move type to extendable event handler

main
Tsu-ba-me 1 year ago
parent bbbdb42d59
commit c03ad02738
  1. 4
      striker-ui/types/ExtendableEventHandler.d.ts
  2. 11
      striker-ui/types/UncontrolledInput.d.ts

@ -0,0 +1,4 @@
type ExtendableEventHandler<T> = (
toolbox: { handlers: { base?: T; origin?: T } },
...rest: Parameters<T>
) => ReturnType<T>;

@ -13,19 +13,14 @@ type MuiInputBasePropsFocusEventHandler = Exclude<
undefined
>;
type UncontrolledInputEventHandler<HandlerType> = (
toolbox: { handlers: { base?: HandlerType; origin?: HandlerType } },
...rest: Parameters<HandlerType>
) => ReturnType<HandlerType>;
type UncontrolledInputComponentMountEventHandler = () => void;
type UncontrolledInputComponentUnmountEventHandler = () => void;
type UncontrolledInputOptionalProps = {
onBlur?: UncontrolledInputEventHandler<MuiInputBasePropsBlurEventHandler>;
onChange?: UncontrolledInputEventHandler<ReactChangeEventHandler>;
onFocus?: UncontrolledInputEventHandler<MuiInputBasePropsFocusEventHandler>;
onBlur?: ExtendableEventHandler<MuiInputBasePropsBlurEventHandler>;
onChange?: ExtendableEventHandler<ReactChangeEventHandler>;
onFocus?: ExtendableEventHandler<MuiInputBasePropsFocusEventHandler>;
onMount?: UncontrolledInputComponentMountEventHandler;
onUnmount?: UncontrolledInputComponentUnmountEventHandler;
};

Loading…
Cancel
Save