Jump to content
Search Community

Typescript can't find typings for import from 'gsap/all'

JohnJesse test
Moderator Tag

Recommended Posts

I don't think the typings are working correctly here.
I was reading through some of the docs and thought that I had the option of importing from `gsap` of `gsap/all` etc
But - when I import from one of the sub files e.g. `gsap/all` typescript fails to find the types for the module
This is resolved if I import from `gsap` instead.

This seems like a bug - as I lose the typings for importing from `gsap/...`

See the Pen by s (@s) on CodePen

Link to comment
Share on other sites

1 minute ago, JohnJesse said:

This is resolved if I import from `gsap` instead.

 

That's a problem with how typescript looks for definitions. When you use "gsap/all", it looks for a package named gsap/all, which of course doesn't exist. So you either have to import from "gsap" in at least 1 file, or tell the compiler where the definitions are in a tsconfig. See the FAQ.

https://greensock.com/docs/v3/Installation

 

{
  "compilerOptions": {
    ...
  },
  "files": [
    "node_modules/gsap/types/index.d.ts"
  ]
}

 

  • 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.
×
×
  • Create New...