Jump to content
Search Community

gsap/react contextSafe callback types

Pim de Wit test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hi,

I am using TypeScript with React and GSAP.

Is there a way to correctly type event callbacks that are wrapped with `contextSafe`?

 

 

const onPointerMove = contextSafe((event: React.PointerEvent) => {});

 

...

// TS2322: Type Function is not assignable to type PointerEventHandler<HTMLDivElement>

<div onPointerMove={onPointerMove}/>

 

 

Here is a demo: 

See the Pen eYXgXXY by pimdewit (@pimdewit) on CodePen

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...