react-awesome-slider icon indicating copy to clipboard operation
react-awesome-slider copied to clipboard

Could not find a declaration file for module 'react-awesome-slider/dist/autoplay'.

Open Mehrdad-Davoudi opened this issue 5 years ago • 2 comments

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));`

Mehrdad-Davoudi avatar Feb 23 '20 18:02 Mehrdad-Davoudi

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

upta avatar Apr 05 '20 21:04 upta

thank you, now it's working.

Mehrdad-Davoudi avatar Apr 06 '20 09:04 Mehrdad-Davoudi