react-awesome-slider
react-awesome-slider copied to clipboard
Could not find a declaration file for module 'react-awesome-slider/dist/autoplay'.
Hi,
I'm using react with typescript but when I want to use auto play getting this error:
Could not find a declaration file for module 'react-awesome-slider/dist/autoplay'. 'c:/Users/.../node_modules/react-awesome-slider/dist/autoplay.js' implicitly has an 'any' type.
Try npm install @types/react-awesome-slider if it exists or add a new declaration (.d.ts) file containing declare module 'react-awesome-slider/dist/autoplay';ts(7016)
and this is my code `import AwesomeSlider from 'react-awesome-slider'; import withAutoplay from 'react-awesome-slider/dist/autoplay'; import withCaption from 'react-awesome-slider/dist/captioned';
const AutoplaySlider = withAutoplay(withCaption(AwesomeSlider));`
Would be nice to have it not be necessary, but it's pretty straight forward to do what the compiler is suggesting.
Literally just add a "react-awesome-autoplay.d.ts" (name doesn't matter, I put mine at the root of my project), and add:
declare module 'react-awesome-slider/dist/autoplay';
to that file
thank you, now it's working.