pmndrs / use-gesture

👇Bread n butter utility for component-tied mouse/touch gestures in React and Vanilla Javascript.

Home Page:https://use-gesture.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing types in useWheel hook

michelecocuccio opened this issue · comments

Hello! Thanks for the awesome library!

I have noticed that the properties last and memo are not typed correctly in the useWheel hook. I have followed the example provided to use wheel with Lethargy but when this is used with Typescript it throws an error as the properties last and memo that are contained in the SharedGestureState are omitted I guess.

Property 'last' does not exist on type 'Omit<SharedGestureState & CommonGestureState & { axis: "x" | "y" | undefined; xy: Vector2; } & { event: WheelEvent; }, "event"> & { ...; }'ts(2339)
Property 'memo' does not exist on type 'Omit<SharedGestureState & CommonGestureState & { axis: "x" | "y" | undefined; xy: Vector2; } & { event: WheelEvent; }, "event"> & { ...; }'.ts(2339)

Screenshot 2022-08-10 at 17 24 23
Screenshot 2022-08-10 at 17 24 38

Information:

  • Use Gesture version: 10.2.17

Checklist:

  • I've read the documentation.
  • If this is an issue with drag, I've tried setting touch-action: none to the draggable element.

There are other closed issues about a similar problem. It's likely to be your local typescript config.

#501

I'll reopen if you're able to submit a repro sandbox on Codesandbox.