SBTech
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by SBTech
-
-
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?
- 2
Right source for Typescript definitions files?
in GSAP
Posted
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.