diff --git a/src/index.ts b/src/index.ts index 2958bae4..dd74914b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,7 +36,7 @@ export { Vector2, }; -const defaultProps: ConfigurationOptions = { +const defaultProps = { delta: 10, preventScrollOnSwipe: false, rotationAngle: 0, @@ -44,7 +44,7 @@ const defaultProps: ConfigurationOptions = { trackTouch: true, swipeDuration: Infinity, touchEventOptions: { passive: true }, -}; +} satisfies ConfigurationOptions; const initialState: SwipeableState = { first: true, initial: [0, 0], @@ -278,9 +278,13 @@ function getHandlers( ], [touchEnd, onEnd, baseOptions], ]; - tls.forEach(([e, h, o]) => el.addEventListener(e, h, o)); + tls.forEach(([e, h, o]) => { + el.addEventListener(e, h, o) + }); // return properly scoped cleanup method for removing listeners, options not required - cleanup = () => tls.forEach(([e, h]) => el.removeEventListener(e, h)); + cleanup = () => tls.forEach(([e, h]) => { + el.removeEventListener(e, h) + }); } return cleanup; }; @@ -395,11 +399,12 @@ export function useSwipeable(options: SwipeableProps): SwipeableHandlers { const [handlers, attachTouch] = React.useMemo( () => getHandlers( - (stateSetter) => - (transientState.current = stateSetter( + (stateSetter) => { + transientState.current = stateSetter( transientState.current, transientProps.current - )), + ); + }, { trackMouse } ), [trackMouse]