janpaepke / ScrollMagic

The javascript library for magical scroll interactions.
http://ScrollMagic.io
Other
14.9k stars 2.17k forks source link

Are there any news for typescript definition files? #664

Open storymessinger opened 7 years ago

storymessinger commented 7 years ago

it would be great if there could be d.ts file for the awesome scrollmagic :)

Any plans? Thanks!

york-xtrem commented 7 years ago

+1

nusson commented 7 years ago

+1

jfleblanc commented 7 years ago

+2

willybrauner commented 7 years ago

+10

mbritton commented 6 years ago

+1

uoziod commented 6 years ago

+1

wbhob commented 6 years ago

Can you please add this functionality @janpaepke

guan-wy commented 6 years ago

+233

uoziod commented 6 years ago

I think it is already sort of time to do it by ourselves, guys? Who have some spare time to join me?

I have only concerns that project owner will pick it up for supporting afterwards...

tony commented 6 years ago

Anyone know an alternative to ScrollMagic that can work with typescript?

In the mean time, how could I ignore / write a type definition for this:

        const sm = new $.ScrollMagic.Scene(options)                                                                                                                                                                                                                                       
          .duration(sectionHeight)                                                                                                                                                                                                                                                        
          .setClassToggle(linkSelector, 'is-active');

Error:

[tsl] ERROR in /home/x/work/develtech/based/ux/js/toc-scroller.ts(213,24)                                                                   │
      TS2339: Property 'ScrollMagic' does not exist on type '{ (selector: any, context: any): any; fn: { [x: string]: any; jquery: string; c│
onstructor: any; length: number; toArray: () => any; get: (num: any) => any; pushStack: (elems: any) => any; each: (callback: any) => any; .│
.. 8 more ...; splice: { ...; }; }; ... 37 more ...; noConflict(deep: any): any; } | ((w: any) => ...'.                                     │
  Property 'ScrollMagic' does not exist on type '{ (selector: any, context: any): any; fn: { [x: string]: any; jquery: string; constructor: │
any; length: number; toArray: () => any; get: (num: any) => any; pushStack: (elems: any) => any; each: (callback: any) => any; ... 8 more ..│
.; splice: { ...; }; }; ... 37 more ...; noConflict(deep: any): any; }'.  
wbhob commented 6 years ago

Anyone want to do a typings PR with me?

tony commented 6 years ago

@wbhob We can PR it against https://github.com/DefinitelyTyped/DefinitelyTyped.

I'm happy to help facilitate, but I'm too new to typescript to lead it.

We should do it for ScrollMagic and for jquery.scrollmagic.

Examples:

https://github.com/danhanfry/KawasakiReproject/blob/bf1a5df46331a4e98968d1c00c04b7826e2761a1/KawasakiReproject/scripts/typings/scrollmagic.d.ts

https://github.com/danhanfry/KawasakiReproject/blob/bf1a5df46331a4e98968d1c00c04b7826e2761a1/KawasakiReproject/scripts/typings/tweenmax.d.ts

https://github.com/BruceWayneLin/TravelWithLayout/blob/025bf472d62f16cec5f6917a9fe7f67c61442ffb/src/assets/layout/%40types/scrollmagic/index.d.ts

https://github.com/13142/WANscrollSite/blob/996bd75a20b4b89db6021b96cd2722e56c590c1f/scripts/typings/globals/scrollmagic/index.d.ts

https://github.com/basp/flow/blob/22928779146d0732502110a56fdec235e84f9a21/scrollmagic.d.ts

https://github.com/Redhotminute/kali/blob/177a542304adeefdf16a053df8f0164b07f55921/scrollmagic.d.ts

@phanronald are you okay licensing your ScrollMagic / Tweenmax typing MIT and putting them into DefinitelyTyped? Or giving us permission to do so?

phanronald commented 6 years ago

@tony @wbhob Sure, you can use what I have if you think it will help you, though it's outdated and you would need to do an import instead of a reference of tweenmax. Also note that the tweenmax.d.ts already exists on DefinitelyTyped.

tony commented 6 years ago

I'm probably abandoning my attempt.

I just can't get custom type definitions to play with with my webpack setup. I can't spend any more time on trying to make this work, I'm better off finding another solution or writing it from scratch in typescript.

The other thing is in my personal project, I had jQuery everywhere, so have to remove that as a dependency.