LucianoGanga / country-codes-list

List of codes per country (languages, calling codes, currency codes, etc)
MIT License
97 stars 48 forks source link

fix: replace CountryProperty enum by union #41

Open alexdeleon opened 11 months ago

alexdeleon commented 11 months ago

The current version of the library does not work with TypeScript. The issue is demonstrated in this sandox. The problem is that index.d.ts exposes an enum type which is used as param in functions like findOne. However, this enum is not backed by any object in JS, so the code compiles but breaks at runtime.

One simple way to fix this, it's by exporting a constant object for the enum (done in #40). However, removing this enum and replacing it with a union type is a more elegant solution which does not need to change the JS implementation.

alexdeleon commented 11 months ago

Fixes #36

flazouh commented 3 months ago

Why is this not merged yet ??