I am trying install react-input-search
. I have error:
Could not find a declaration file for module 'react-search-input'. '.../app/node_modules/react-search-input/lib/index.js' implicitly has an 'any' type. Try
npm install @types/react-search-input
if it exists or add a new declaration (.d.ts) file containingdeclare module 'react-search-input';
ts(7016)
The error "could not find declaration file for module 'react'" occurs when TypeScript cannot find the type declaration for a react-related module. To solve the error install the types for the module by running the command from the error message, e.g. npm install -D @types/react .
When you have this error, it is usually because you installed a library and you didn't install the types of that library. To fix this error, you need to install @types/library-name using your package manager (npm or yarn).
This is a common error that you can simply solve by creating an index.d.ts
file and then add a declaration line like this:
declare module 'react-input-search';
You can save this file anywhere you wish but make sure to add the filepath to tsconfig.json
like this "typeRoots": [
"types/index.d.ts"
],
This is assuming you saved it in types/index.d.ts
Typescript should go with Typescript NPM package, the Typescript NPM package had prefix @types/ on it name. The NPM package react-search-input do not had Typescript package for it yet, then you can simple fix by following
And it should working fine
It's a typescript error. It means that there is no type declarations in 'react-input-search' library. There is no package 'react-input-search' with types for it, so you need to declare usage of these library in your project by creating a file with extension .d.ts
(for example libraries.d.ts
) and insert a line declare module 'react-search-input';
into it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With