Jump to content

Matheus Verissimo

Usage with typescript

Recommended Posts

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:




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!!

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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:




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!!

  • Like 4
Link to comment
Share on other sites


Thank's for helping, I was lost how to define @types


t: ReturnType<typeof TweenLite.to> | null;


  • Like 2
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.