import { useEventCallback } from "./useEventCallback" ; type ChainableFunction = ( ... args : any [ ] ) => void ; export function createChainedFunction < T extends ChainableFunction > ( ... funcs ) { return ( ... args ) => { ( funcs . filter ( Boolean ) as T [ ] ) . forEach ( x => { x ( ... args ) ; } ) ; } ; } export function useChainedEventCallback < T extends ChainableFunction > ( ... callbacks ) { return useEventCallback ( createChainedFunction ( ... callbacks ) ) ; }