jfilter / react-native-onboarding-swiper

🛳 Delightful onboarding for your React-Native app
https://www.npmjs.com/package/react-native-onboarding-swiper
Other
986 stars 180 forks source link

TypeScript declaration error #90

Closed matheusgoc closed 4 years ago

matheusgoc commented 4 years ago

When try to use the component with TypeScript, it asks to declare a type:

_TS7016: Could not find a declaration file for module 'react-native-onboarding-swiper'. '/Users/matheuscamara/www/piggy-bank-app/nodemodules/react-native-onboarding-swiper/src/index.js' implicitly has an 'any' type.   Try npm install @types/react-native-onboarding-swiper if it exists or add a new declaration (.d.ts) file containing declare module 'react-native-onboarding-swiper';

And then, you cannot go any further!

I have tried to install the type executing the following command, but it seams that it does not exists actually:

npm install @types/react-native-onboarding-swiper

So, for those that are facing the same problem, the solution I got was to do the working around of creating a file with the extension .d.ts (e.g. react-native-onboarding-swiper.d.ts) and declare the type this way:

declare module 'react-native-onboarding-swiper';

Anyway, the type could come pre-defined from the component itself, I guess!

jfilter commented 4 years ago

I have no idea about TypeScript, but I am pretty sure that there is a way to integrate ordinary JavaScript modules.

If somebody wants to add some TypeScript stuff: please send PRs. ;)