Error: "Could not find a declaration file for module 'react-search-input'"
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.
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
- Create file with name globals.d.ts and put on your source root of Typescript watcher folder
- Put declare module 'react-search-input' on that file
And it should working fine
You can always create the type definition library for this library react-search-input and put it on definitelytyped so now everyone including you can use it. Here is a guide with examples on how to create a type definition library.
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