react-country-flag: Declaration File missing
What I have done : npm install --save react-country-flag
react-country-flag folder appears well in my node-modules.
Then : import ReactCountryFlag from "react-country-flag"; from a .ts file
Gets me this error :
Could not find a declaration file for module 'react-country-flag'. '/home/{...}/node_modules/react-country-flag/dist/index.js' implicitly has an 'any' type.
Try `npm install @types/react-country-flag` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-country-flag';` TS7016
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 23 (9 by maintainers)
Commits related to this issue
- feat(react-country-flag): new definition - definition file - tests see: danalloway/react-country-flag#16 /cc @r3wt @FabianoLothor @thibaultboursier Thanks! Closes #46420 — committed to peterblazejewicz/DefinitelyTyped by peterblazejewicz 4 years ago
- feat(react-country-flag): new definition - definition file - tests see: danalloway/react-country-flag#16 /cc @r3wt @FabianoLothor @thibaultboursier Thanks! Closes #46420 — committed to peterblazejewicz/DefinitelyTyped by peterblazejewicz 4 years ago
Any update on this?
@r3wt @thibaultboursier I may prefer the manual / static file this code base won’t change much as it’s a pretty dead simple library will update you all ASAP when I make the change
Hello @danalloway @FabianoLothor @r3wt,
I opened a PR to add TypeScript and generate declaration files each time project is built. You can check it here.
just released version v3.0.1 with Typescript support
working on a Typescript version of this library, should publish today
tnx!!
Here are some declarations i wrote for v2. It’s not perfect, but it seems to work for me. Maybe someone who is better at TS can come along and make it perfect.
@danalloway I fix it in my project with this workaround:
@thibaultboursier just checking in on this, if you’re still going to do it i’ll leave this issue open, otherwise please close it out for me, thank you
Ok, i’ll doit that soon.
v2 is out, ready for that declaration file if you’re still up for it