Jump to content
Search Community

SBTech

Business
  • Posts

    2
  • Joined

  • Last visited

Posts posted by SBTech

  1. 10 hours ago, OSUblake said:

    I'm creating a new set of definitions for the project I'm currently working on, but they aren't complete. I've only added the stuff I needed, but we can add to the package when I'm done. If you need any definitions for a plugin or something, just let me know, I can post it.

     

    Although we bought it the business green or whatever package the major reason we can't adopt GSAP today is because it doesn't have type declarations.

    • Like 1
  2. 3 hours ago, OSUblake said:

    Try this one. They're not 100% complete, but should be ok for normal usage.

     

    
    npm install --save @types/gsap

     

     

    If you import files individually like this...

     

    
    import { TweenLite, Linear } from "gsap/TweenLite";
    import { TweenMax } from "gsap/TweenMaxBase";
    import { TimelineMax } from "gsap/TimelineMax";
    import "gsap/CSSPlugin";

     

     

    Or all of them like this this...

     

    
    import {
      CSSPlugin,
      TweenMax,
      TimelineMax,
      Linear
    } from "gsap/all";

     

     

    Then you'll need to declare the modules in a d.ts file somewhere. So something like this. This isn't complete. Just showing how.

     

    
    declare module "gsap/TweenLite" {
    
      export {
        TweenLite as default,
        TweenLite,
        Animation,
        Ease,
        Linear,
        Power0,
        Power1,
        Power2,
        Power3,
        Power4,
        TweenPlugin
      } from "gsap";
    
      export class EventDispatcher { }
    }
    
    declare module "gsap/TweenMaxBase" {
      export { TweenMax as default, TweenMax } from "gsap";
    }
    
    declare module "gsap/TimelineLite" {
      export { TimelineLite as default, TimelineLite } from "gsap";
    }
    
    declare module "gsap/TimelineMax" {
      export { TimelineMax as default, TimelineMax } from "gsap";
    }
    
    declare module "gsap/CSSPlugin" {
    
      class CSSPlugin { }
      export { CSSPlugin as default };
    }
    
    declare module "gsap/all" {
    
      import CSSPlugin from "gsap/CSSPlugin";
    
      export { CSSPlugin };
      export * from "gsap/TweenLite";
      export * from "gsap/TweenMaxBase";
      export * from "gsap/TimelineLite";
      export * from "gsap/TimelineMax";
    }

     

     

     

    Why don't you just commit this index.d.ts file into the NPM package?

    • Like 2
×
×
  • Create New...