Jump to content
GreenSock

Tee

Building Angular project returns typeof error for TweenLite using 'set'

Moderator Tag

Recommended Posts

To implement a smooth scroll I used TweenLite.set{.. within my code. Serving the project works fine without any errors. But as soon as I try to build the project using ng build, it throws following error:

 

Quote

Property 'set' does not exist on type 'typeof TweenLite'.

 

How so?

 

import { TweenLite } from 'gsap';

...

TweenLite.set(this.scroller.target, {
    rotation: 0.01,
    force3D: true
});
"dependencies": {
    "@angular/animations": "~8.1.2",
    "@angular/common": "~8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/core": "~8.1.2",
    "@angular/fire": "^5.2.3",
    "@angular/forms": "~8.1.2",
    "@angular/platform-browser": "~8.1.2",
    "@angular/platform-browser-dynamic": "~8.1.2",
    "@angular/router": "~8.1.2",
    "@types/gsap": "^1.20.2",
    "bootstrap": "^4.4.1",
    "firebase": "^7.6.1",
    "gsap": "^3.1.1",
    "rxjs": "~6.4.0",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
}

 


 

Link to comment
Share on other sites

Hey Tee, welcome to the GreenSock forums. 

 

If you import gsap instead of TweenLite and use that instead, does it still cause the error?

 

Side note: You shouldn't load the @types definitions when using GSAP 3. GSAP 3 has its own type definitions bundled with it.

  • Like 2
Link to comment
Share on other sites

For what it's worth, Angular has some known issues with their bundler, as referenced here:

Basically it tree shakes incorrectly, flagging (and dumping) code that it thinks is irrelevant but isn't. Maybe reach out to the Angular folks? I'm pretty confident it's not a GSAP issue. 

  • Like 2
Link to comment
Share on other sites

49 minutes ago, ZachSaucier said:

Hey Tee, welcome to the GreenSock forums. 

 

If you import gsap instead of TweenLite and use that instead, does it still cause the error?

 

Side note: You shouldn't load the @types definitions when using GSAP 3. GSAP 3 has its own type definitions bundled with it.

 

Thank you - using gsap.set(... did the trick!

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