manuelmhtr / countries-and-timezones

Minimalistic library to work with countries and timezones data
MIT License
224 stars 67 forks source link

Incorrect Types #58

Closed acommodari closed 9 months ago

acommodari commented 10 months ago

This library does not work correctly in TypeScript if you are using module node16 or nodenext.

This is further confirmed if you check ATTW: https://arethetypeswrong.github.io/?p=countries-and-timezones%403.5.1

You would need to export separate types for both require and esm with the appropriate extensions.

acommodari commented 10 months ago

As the docs from ATTW mention the solution should be to create 2 sets of declaration files (at least to fix the masquerading issue) https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseESM.md

As for the default export it doesnt affect me personally since im not using a bundler but im guessing it would be good to fix that issue at the same time https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/CJSOnlyExportsDefault.md

manuelmhtr commented 9 months ago

Hi @acommodari thanks for reporting the issue. I'll add it to the backlog of the project. Any help would be appreciated.

acommodari commented 9 months ago

I could try helping although I'm not really familiar with Rollup so not sure how useful I'll be. 😞

manuelmhtr commented 9 months ago

Hi @acommodari no problem. I found the problem and it is fixed in v3.5.2.

https://arethetypeswrong.github.io/?p=countries-and-timezones%403.5.2

Best ✌️