import { ReactEventHandler } from 'react' ; export type Close = ReactEventHandler ; export type ClosePromise = { reject ? : ReactEventHandler ; accept ? : ReactEventHandler ; complete ? : ReactEventHandler ; } ; export type onClose = Close | ClosePromise ; export function useClose ( onClose ) { if ( ! onClose ) return { } ; const { accept , complete , reject } = onClose as ClosePromise ; return { accept , complete : typeof onClose === 'function' ? onClose : complete , reject , } ; }