Jump to content
Search Community

ScrollTo plugin gives eslint error when used with TypeScript

yousoumar test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi guys !

 

I installed @types/greensock and started using Gsap with TypeScript. Everything works fine, but the ScrollTo plugin is giving this eslint error (image attached). Someone knows something about it ? At least I want to be able to tell eslint to ignore this error.  

 

Thank you !

import { ScrollToPlugin } from "gsap/ScrollToPlugin";
import { gsap } from "gsap";
gsap.registerPlugin(ScrollToPlugin);

export const headerInteractionHandler = () => {
  document.querySelector("header .logo").addEventListener("click", (e) => {
    e.preventDefault();
    let element = <HTMLAnchorElement>e.currentTarget;

    gsap.to(window, {
      duration: 0.8,
      scrollTo: `${element.getAttribute("data-destination")}`,
    });
  });
};

Screenshot 2022-01-23 at 17.17.31.png

Link to comment
Share on other sites

  • Solution

You definitely shouldn’t be using the @types/greensock package - that was never from GreenSock (someone else made it) and it hasn’t been updated in 5+ years. 

 

The GSAP package itself comes with TypeScript definition files so you shouldn’t need to install anything else. 

  • Like 1
Link to comment
Share on other sites

41 minutes ago, GreenSock said:

You definitely shouldn’t be using the @types/greensock package - that was never from GreenSock (someone else made it) and it hasn’t been updated in 5+ years. 

 

The GSAP package itself comes with TypeScript definition files so you shouldn’t need to install anything else. 

Thanks for pointing out. I didn't know. I deleted it, changed my .eslitnrc parser to  @typescript-eslint/parserand the error is gone.

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