I have created a react typescript project with CRA with the command yarn create react-app my-app --typescript
now I have a module foo
installed that does not have any typing not by default, not in defentlytyped repository.
i.e. in a component, I have
import {bar} from 'foo';
which throws error Type error: Could not find a declaration file for module 'foo'. '/*/node_modules/foo/dist/entry.js' implicitly has an 'any' type.
I created foo.d.ts
in types folder at the root of the project like
declare module 'foo'{ import * as React from 'react' }
just to have the foo
as type any
but still, get the same error. it seems that whatever compiler (webpack,other transpiler) does not find the declaration at types
folder
how can I add custom type declaration to the project?