Jump to content
Search Community

GSAP 3 + Vue 3 Typescript error

lelukas test
Moderator Tag

Recommended Posts

Hi everyone.

 

In a Vue component file, I have the following:

 

let timeline = $ref<GSAPTimeline>()

This works fine as I have in my tsconfig.app.json file

"files": [
  "node_modules/gsap/types/index.d.ts"
]

 

However, when I try to assing a value to the ref, I get a type error

 

TS2322: Type 'Timeline' is not assignable to type 'ReactiveVariable<{ [x: string]: any; autoRemoveChildren: boolean; labels: Labels; smoothChildTiming: boolean; vars: { [x: string]: any; autoRemoveChildren?: boolean | undefined; defaults?: { [x: string]: any; ... 495 more ...; onUpdateParams?: any[] | undefined; } | undefined; ... 22 more ...; onUpdateParams?: any[]...'.

 

How can I make it work with vue refs?

Link to comment
Share on other sites

Hi @lelukas. Sorry, I'm not much of a Vue or TypeScript guy. We're happy to answer any GSAP-specific questions here but that sounds more like a configuration thing on your local system with your build system. I really wish I had an answer for you. I know that plenty of people use GSAP in Vue and lots of TypeScript environments too - I'm just not sure what's going on with your particular environment there, sorry. Maybe someone else will have an idea.

Link to comment
Share on other sites

Hi, I‘m not a Vue person at all, I do work with TypeScripte though.

The information you offer is rather sparse, but from what I can see it seems to me that the definition is found correctly, but that is used on an object that isn‘t a timeline. 
 

can it be that instead of (pseudo-pseudo-code):

 

stuff = new GSAPTimeline  (something );

 you have
 

stuff = something;

 

just a guess

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