Jump to content
Search Community

typescript build error "Duplicate identifier 'TimelineMax'"

TOB test
Moderator Tag

Recommended Posts

ive added both gsap (npm install --save gsap) and @types/greensock (npm install --save-dev @types/greensock) to my prototype app I am using to learn more about greensock.  npm install completes successfully, however when building the app, I get a "Duplicate identifier 'TimelineMax'" error. 

 

I've confirmed that there are multiple definitions of this and other gsap classes in both these lib's (found in gsap-core.d.ts for gsap and index.d.ts for @types/greensock).

 

I did find the install instructions (here: https://greensock.com/docs/v3/Installation) which references 'typescript errors" re: locations of types being defined - - - but that didn't work.  Was wondering if there is something else I am missing?

 

Thx in advance for any insights

Link to comment
Share on other sites

Hey TOB and welcome to the GreenSock forums!

 

Uninstall the @types declarations - you don't need them and they are invalid with GSAP 3 (not to mention not complete for GSAP 2). The official Typescript declarations come with GSAP when you install it.

 

By the way, there's no reason to use the Max/Lite stuff in GSAP 3. Just use the GSAP object. For more information check out the migration guide:

 

 

Link to comment
Share on other sites

Thanks - that did the trick.  I had to add an empty "files" : [ ] to my tsconfig as well (to get around an error "./gsap-utils.d.ts (209,10): A rest parameter must be of an array type."... I suspect that perhaps my typescript version is not recent enough [~2.5.3 atm]).  This empty config entry is throwing my lint'r off its game 😕  BUT app does compile and I can run the animations easily.

 

Thanks again for the assist - great forum support (which makes all the difference); and gsap is fall-down easy to use.

 

Link to comment
Share on other sites

13 minutes ago, TOB said:

to get around an error "./gsap-utils.d.ts (209,10): A rest parameter must be of an array type."

 

Is that pointing to this the gsap-utils.d.ts file?

 

image.png.e50945d0bfc898fc29173564cd47b6cd.png

 

It's seem weird that in would complain about that when there are rest params before it.

 

 

 

 

Link to comment
Share on other sites

Yes - thats the one, with the 'G' template item.  

 

edit: That 209 was at the top of the stack, but if I scroll down more in the build error list I do see the others.

Edited by TOB
added details re: build error stack
Link to comment
Share on other sites

I'm looking into that option now.  I have a specific version of typescript I use at work as part of a larger dev team; but will see if I can use a later version of typescript (e.g. something like npm install --save-dev typescript@latest) for this prototype.

 

Is there a recommended version of typescript in your opinion?  or is latest best?

 

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