jlmakes / scrollreveal

Animate elements as they scroll into view.
https://scrollrevealjs.org/
22.3k stars 2.26k forks source link

Cannot find clean method or options in TypeScript #513

Closed GiorgioPeng closed 4 years ago

GiorgioPeng commented 4 years ago

when I use create-react-app and Typescript.

ScrollReveal().reveal("#xx",{ duration: 500,distance: '30px',clean:true})
截屏2020-03-26 上午12 32 09

And it reminds me can not find "clean". And when I checked the Declaration file which is created by ts, I also could not find the "clean" attribute. Can I use it in TypeScript?

截屏2020-03-26 上午12 30 19
jlmakes commented 4 years ago

I believe you're referring to options.cleanup, which is an option to control whether or not the clean() method is called automatically after reveals.

GiorgioPeng commented 4 years ago

Sorry, I made a mistake. But when I tried to use the options.cleanup, it still reminded me there is something wrong.

截屏2020-03-26 上午8 20 27
GiorgioPeng commented 4 years ago

And I found a mistake in the API documentation.

截屏2020-03-26 上午8 45 25
jlmakes commented 4 years ago

Well there aren't first party typings. Where are you getting these types? Specifically, where is the ScrollRevealObjectOptions interface defined?

GiorgioPeng commented 4 years ago

Thank you, I know how to solve the problem now. I got it by

yarn add @types/scrollreveal

The interface is defined from here