Jump to content
Search Community

In TypeScript, gsap is defined even when it shouldn't be

RJWadley test
Moderator Tag

Recommended Posts

If GSAP is imported into at least one file, it is then defined in every file including where it shouldn't be. This also happens to all the plugins.

 

Here's a code sandbox that hopefully illustrates the issue a bit better: https://codesandbox.io/s/gsap-import-types-p88m1x?file=/src/App.tsx

(btw, you need to open both files, see the note in the sandbox for why)
In that sandbox, I would expect a type error at compile time but instead get a reference error at runtime.

The setup here is pretty minimal, but have I set up GSAP incorrectly here?

Link to comment
Share on other sites

I'm a bit confused, @RJWadley, about why you're not importing GSAP properly in your App.tsx file (you commented it out, right?) Can you help me understand what your goal is there by omitting it? 

 

This certainly sounds more like a TypeScript question (I'm not much of a TypeScript guy). TypeScript definitions are included in the NPM package. Is there a GSAP-specific question we could help with? 

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