Closed n8sabes closed 4 years ago
There was a lingering @types/gsap
in the project that needed to be removed. For some reason it didn't cause an issue in 3.0.1 but does in 3.0.2.
This works:
import gsap from "gsap";
const tweenRef: MutableRefObject<GSAPAnimation | null> = useRef(null);
Hi @n8sabes
It looks like you found some of the global types that have been added to 3.0.2. GSAPAnimation
is the base class that GSAPTween
and GSAPTimeline
extend. If it's supposed to be a tween, you're probably better off doing this as Tween has some properties/methods that don't exist on Animation.
const tweenRef: MutableRefObject<GSAPTween | null> = useRef(null);
I plan on documenting all those types so people don't run into problems like this.
Thank you, @OSUblake.
3.0.2 release breaks TypeScript projects. Is there a GSAP 3.x TypeScript accurate reference / tutorial / example?
Worked in 2.x:
Worked in 3.0.1:
3.0.2 ?????
3.0.2 Assigning result from
gsap.to()
to theref.current
generates this error:Type 'Tween' is not assignable to type 'TweenLite | TweenMax | null'. Type 'Tween' is missing the following properties from type 'TweenMax': updateTo, target, timelinets(
3.0.2 type defines the result from
gsap.to
as a<core.Tween>