GSAP
GSAP
Menu
Tools
Core
Scroll
SVG
UI
Text
Installation
Starter Templates
GSAP & React
Video Lessons
Pricing
Showcase
Resources
Community
Docs
Notifications
Notifications
Notification Settings
View All
Messages
Messages
Compose new
Go to Inbox
Login/Create Account
Sign In
Why create an account?
It's free
Participate in the forums
Updates on the products you use
Exclusive offers and more
Create an Account
My Account
Dashboard
Orders & Billing
Account Settings
Logout
Get GSAP
Tools
Core
Scroll
SVG
UI
Text
Pricing
Showcase
Resources
Community
Docs
Login/Create Account
Dashboard
Orders & Billing
Account Settings
Logout
Messages
Notifications
Sign In
Login
Forgot your password?
Not got an account?
Create an Account
CodePen
GitHub
Facebook
LinkedIn
Twitter
Jump to content
Leaderboard
More
More
All Activity
Home
StGewehr
Search Community
Everywhere
Topics
Members
StGewehr
Members
Posts
5
Joined
March 23, 2021
Last visited
March 16, 2023
StGewehr's Profile
See their activity
Community Answers
StGewehr's
post
in
TypeScript: extend GSAP classes with custom methods and add typings
was marked as the answer
March 31, 2021
Hi @OSUblake !
My thanks for quick response. Actually, I was very close, I just split declaration and addition of a method to prototype into different files, and it works fine.
So it should look something like this (perhaps for those who find this topic).
//some index.ts /// <reference path="./utils/extensions/gsap.d.ts"/> import "./utils/extensions/gsap.extensions"; //gsap.d.ts declare namespace gsap.core { export interface Timeline { deepKill(): void; } } //gsap.extensions.ts import { gsap } from "gsap"; gsap.core.Timeline.prototype.deepKill = function () { this.getChildren(true, true, true).forEach((animation) => animation.kill()); this.kill(); };
Thanks,
Yury
Blogs
All Activity
Home
StGewehr
×
Existing user? Sign In
Sign Up
Leaderboard
×
Create New...