Jump to content
Search Community

StGewehr

Members
  • Posts

    5
  • Joined

  • Last visited

Community Answers

  1. StGewehr's post in TypeScript: extend GSAP classes with custom methods and add typings was marked as the answer   
    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
×
×
  • Create New...