LucianoGanga / country-codes-list

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

Typescript index Incorrect computed property name type #33

Closed steinsroka closed 1 year ago

steinsroka commented 1 year ago

Hello,

The computed property name type in the customList function might incorrect. Currently, the code attempts to use CountryProperty as a computed property name, but TypeScript throws an error because CountryProperty is not a literal type or a unique symbol type.

The corrected code can be

index.d.ts:60

export function customList(
  key?: CountryProperty,
  label?: string,
  settings?: CustomArraySettings,
): { [K in CountryProperty]: string };

or

export function customList(
  key?: CountryProperty,
  label?: string,
  settings?: CustomArraySettings,
): { [key: string]: string };
LucianoPaci commented 1 year ago

Thanks! This was fixed on v1.6.11