-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type error: Could not find a declaration file for module 'country-flag-emoji-polyfill' #8
Comments
Could you try to debug it? Eg edit the package.json (right there in your node_modules/country-flag-emoji-polyfill) until it works? And does it then still work when you change Full disclosure, I’m no npm packaging guru so I would appreciate any help I can get |
Neither am I 😅 I know it (npm packaging) can be a nightmare to get right though. Anyway, the error does go away when I get back to Some quick google results: |
Ok, I got it to work. Here's what I did:
I'm not completely sure if all of these steps are necessary/correct, so take that as you will. Some extra reading:
Hope this helps! |
I am also facing this issue using bundler as module resolution. |
I'm not sure how to solve this and I would appreciate PRs. Thing is, @pete-willard's suggestions look nice but I worry that what fixed it for him may break things for others (including ourselves). Eg the nonstandard file extensions (or at least I'm not even sure how standard they are, just, it's Node-specific maybe?) Stuff like that. I haven't yet found a comprehensive guide about best practices for this stuff, ie how to package a library such that it works in all common bundlers, compilers and toolchains, and I'd appreciate some help. Unfortunately I do not currently have the time to get to the bottom of this myself (eg try all popular bundlers with all popular settings and mess around until it works everywhere - that's a big project for a small polyfill). |
I'm closing this issue for lack of responses. I'm eager to address this but I'm not sure how and I currently lack the time to dive deep enough. Anyone, feel free to reopen if you run into this and/or know a robust solution! |
Hi Egbert! I switched the
moduleResolution
flag in tsconfig fromnode
tobundler
and I'm getting the following error:Type error: Could not find a declaration file for module 'country-flag-emoji-polyfill'. '(...)/node_modules/.pnpm/country-flag-emoji-polyfill@0.1.4/node_modules/country-flag-emoji-polyfill/dist/index.modern.js' implicitly has an 'any' type. There are types at '(...)/node_modules/country-flag-emoji-polyfill/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'country-flag-emoji-polyfill' library may need to update its package.json or typings.
The text was updated successfully, but these errors were encountered: