react-scrollama icon indicating copy to clipboard operation
react-scrollama copied to clipboard

Providing Types for TypeScript?

Open alinoob opened this issue 2 years ago • 5 comments

Would it be possible to publish types for TypeScript?

alinoob avatar Jan 17 '23 00:01 alinoob

@alinoob I also think type definitions would be helpful! You may have already found a workaround, but I wanted to include one I found here too for future people looking to use this repo.

I found this workaround from this article. Basically, create a decs.d.ts file and the line declare module "react-scrollama". Then, you just have to make sure the include field in your tsconfig.json will pick up decs.d.ts.

I'm still pretty new to working with TypeScript, so there may be better workarounds, but this did the trick for me!

chasedawson avatar Jan 27 '23 16:01 chasedawson

I actually switched to the gsap library which is pretty neat aswell. But thanks for your reply.

alinoob avatar Jan 27 '23 21:01 alinoob

I actually switched to the gsap library which is pretty neat aswell. But thanks for your reply.

Is gsap doing the same doing scrollama?

0xMohamed avatar Feb 02 '24 12:02 0xMohamed

I dont think so. I just read https://gsap.com/docs/v3/Plugins/ScrollTrigger/#how-does-scrolltrigger-work-is-it-just-like-intersectionobserver

React Scrollama is pretty simple, it's just a wrapper around IntersectionObserver, and it's meant to serve use cases that aren't that complex (e.g. a simple scrollytelling article). GSAP seems to be doing much more complex stuff, and also uses (debounced) scroll events rather than IntersectionObserver. And it seems to be used for fairly involved interactions/animations.

squirrelsquirrel78 avatar Feb 02 '24 15:02 squirrelsquirrel78

but sometimes in scrollama with intersection Observer does not detect all steps successfully when scrolling fast or when there are complex state changes.

0xMohamed avatar Feb 02 '24 16:02 0xMohamed