Если либа не экспортирует нужные ей типы, то я бы так попробовал:
type EventData = {
event: Parameters<typeof thumbHandler>[0];
};
const handleThumbEnd = (eventData: EventData) => thumbHandler(eventData.event, true);
const handleThumbMove = useThrottledFn(
(eventData: EventData) => thumbHandler(eventData.event),
250,
);
const handlers = useSwipeable({
onSwiping: handleThumbMove,
onSwiped: handleThumbEnd,
preventDefaultTouchmoveEvent: true,
trackMouse: true,
trackTouch: true,
});
или так:
type HandlerMove = Parameters<typeof useSwipeable>[0]['onSwiping'];
type HandlerEnd = Parameters<typeof useSwipeable>[0]['onSwiped'];
const handleThumbEnd: HandlerMove = (eventData) => thumbHandler(eventData.event, true);
const handleThumbMove: HandlerEnd = useThrottledFn(
(eventData) => thumbHandler(eventData.event),
250,
);
const handlers = useSwipeable({
onSwiping: handleThumbMove,
onSwiped: handleThumbEnd,
preventDefaultTouchmoveEvent: true,
trackMouse: true,
trackTouch: true,
});
или так