Share Posted February 18, 2019 Does someone try or have an example of usage with typescript and reactjs? Link to comment Share on other sites More sharing options...
Share Posted February 18, 2019 Hi, React yes, but React with typescript is out of my range, since I don't use typescript. I made this sample and it seems to work, at least on stackblitz: https://stackblitz.com/edit/gsap-react-typescript But I see some errors being displayed there, probably because of something I'm not doing correctly typescript-wise. I'll summon @OSUblake, our resident typescript wizard and see if we can get an explanation and a cool, mind-blowing/jaw-dropping example Happy Tweening!! 1 1 Link to comment Share on other sites More sharing options...
Share Posted February 19, 2019 Ok, so I did some research on the subject and this whole typescript is quite beyond my area of knowledge. Lucky for me I got in touch with this awesome guy in Reactiflux discord app: Damien Erambert (Twitter - GitHub) and He pointed me in the right direction. Turns out that first of all you need to import the type definitions for gsap from this package: https://www.npmjs.com/package/@types/gsap And then define both the GSAP instance and the DOM ref as the return values of the GSAP instance and the ref. I've updated the stackblitz sample so you can check it. Happy Tweening!! 4 Link to comment Share on other sites More sharing options...
Author Share Posted February 19, 2019 Hi! Thank's for helping, I was lost how to define @types t: ReturnType<typeof TweenLite.to> | null; 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now