I am totally new to ReactJS and I found myself stuck in the next thing. I have installed react-cards via npm like this:

npm install --save react-cards

Installation was ok and I want to import it in my code like this:

import Card from 'react-cards';

But then I got error saying this:

Could not find a declaration file for module 'react-cards':'path' implicitly has an 'any' type. Try 'npm install @types/react-cards' if it exists or add a new declaration(.d.ts) file containing 'declare module 'react-cards';'.

I have tried with npm install @types/react-cards but nothing changed.

I don't know what to do.

If you're using VS Code, there's a quick fix suggestion for this you can invoke with <kbd>Ctrl</kbd> + <kbd>.</kbd>

Install missing types

You can also automatically add all missing types with typesync like this:

npx typesync

If the package doesn't have it's own types, and it hasn't been added to DefinitelyTyped, you'll need to add a new definitions file

Further Reading