jackocnr/intl-tel-input

Typescript definitions wrong with 21.2.6

Closed this issue · 9 comments

Steps to reproduce

  1. Compile TS with libCheck

Expected behaviour

Success

Actual behaviour

Error: node_modules/intl-tel-input/build/js/intlTelInput.d.ts:545:37 - error TS2307: Cannot find module 'i18n/en/countries.mjs' or its corresponding type declarations.
545 import countryTranslations from "i18n/en/countries.mjs";
~~~~~~~~~~~~~~~~~~~~~~~
Error: node_modules/intl-tel-input/build/js/intlTelInput.d.ts:546:39 - error TS2307: Cannot find module 'i18n/en/interface.mjs' or its corresponding type declarations.
546 import interfaceTranslations from "i18n/en/interface.mjs";
~~~~~~~~~~~~~~~~~~~~~~~

Initialisation options

Thanks for reporting this. Can you confirm that it works fine in the previous version: v21.2.5?

@jackocnr Yes. I temporary reverted to this version.

Thanks. @anthony0030 this error must be a result of the translation export changes we made - is there any chance you could take a look at this?

Looking at the difference between the types file in v21.2.5 vs v21.2.6 I think the problem is just that the 2 new imported modules have ".mjs" on the end, as the importing works fine a few lines later: import { Country } from "intl-tel-input/data";. So I wonder if we can just remove those extensions from the 2 imports in src/js/i18n/en/index.mjs (tho this may only work if we make all of these translation files have .ts extensions in src/ which would then require adding a build step to get .mjs files in build/ but hopefully this won't be necessary)

Hi @jackocnr, I don’t have any experience really with TS. I would love to help but don’t know how.

No worries, I'll take a look when I find some time.

Just another datapoint. Our CI build broke when trying to update to the newest version this morning. Fixing the library to 21.2.5 resolved the issue in the short tem.
Thank you for supporting this package for such a long time!

@Delagen I've implemented the fix I mentioned here, and released it as v21.2.8 - can you give that a try and see if that fixes your issue?

@Delagen I've implemented the fix I mentioned here, and released it as v21.2.8 - can you give that a try and see if that fixes your issue?

Seems it works now. Thanks.