Jump to content
Search Community

Timeline.seek typescript typings

spassvogel test
Moderator Tag

Recommended Posts

According to the docs https://greensock.com/docs/v3/GSAP/Timeline/seek() the seek() method takes either a string or a number as its first argument. However, the typescript typings currently say:    seek(time: number, supressEvents?: boolean): this;

 

So the TS compiler throws a an error:

Argument of type 'string' is not assignable to parameter of type 'number'.

 

Using "gsap": "^3.2.6"

 

  • Like 2
Link to comment
Share on other sites

5 hours ago, spassvogel said:

are PRs about typings accepted?

 

No. The main repo is private. If there's a problem with the typings, just raise an issue. And it looks like this has already been fixed in the next release.

 

In the meantime, you can ignore the error.

// @ts-ignore
tl.seek("")

 

Or augment the types in a d.ts file.

declare namespace gsap.core {
  interface Timeline {
    seek(time: number | string, supressEvents?: boolean): this;    
  }
}

 

  • Like 1
  • Thanks 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...