Jump to content
Search Community

ScrollTrigger typescript definitions

hexagoncircle test
Moderator Tag

Recommended Posts

Hello! I'm importing ScrollTrigger into a React component and noticed the ScrollTrigger import redlining.

 

  • I installed gsap with yarn.
  • I tried including the @types/gsap package but I see that all of the types are included in the gsap package already.
  • There is a scroll-trigger.d.ts file in the gsap package but my import can't seem to find it.
  • I've tried importing a few other plugins and they work as expected.

 

Let me know if you have any ideas or if there's any additional info that I can provide. Thanks!

 

Error message:

Could not find a declaration file for module 'gsap/ScrollTrigger'. '[directory-name]/node_modules/gsap/ScrollTrigger.js' implicitly has an 'any' type. Try `npm install @types/gsap` if it exists or add a new declaration (.d.ts) file containing `declare module 'gsap/ScrollTrigger';`

 

scrolltrigger-import-redline.png

Link to comment
Share on other sites

Hey hexagoncircle and welcome to the GreenSock forums. 

 

13 minutes ago, hexagoncircle said:

I tried including the @types/gsap package but I see that all of the types are included in the gsap package already.

Don't use @types. GSAP comes with its own official and more full declarations now. I recommend removing the @types ones.

 

This has already been brought up on GitHub. You can view the fix here which will be included in the next version of GSAP. Let us know if that doesn't fix the issue for you.

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