Skip to main content
@talosjs/country ships curated country datasets — each entry a { name, code } pair keyed by ISO 3166-1 alpha-2 code — localized into English, German, Spanish, and Italian, plus the ICountry interface and supporting types for modeling a country as a stored entity with its own timezone and language.

Installation

Add the package with Bun.

Usage

Browse a dataset

Each locale exports its own constant. Look up a country by code, or list every entry to drive a picker.

Typed codes and names

CountryType and CountryNameType are unions derived from the English dataset, so a country code or name can be validated or narrowed at compile time.

Modeling a country entity

ICountry describes a country as a persisted record — the same lock/block/public/soft-delete metadata shared by other Talos resources — with a language (a LocaleType from @talosjs/translation) and a code.

Timezones

TimeZoneType is the name union from @vvo/tzdb’s TimeZone, giving you a typed IANA timezone identifier (e.g. "Europe/Paris") to pair with a country record.

Available locales

Each dataset has the same shape and country ordering, so switching locales is a matter of swapping the imported constant — pair it with the current translation locale to render country names in the user’s language.

When it earns its place

Reach for @talosjs/country for a typed, localized country list — populating a country selector, validating a stored code against a known set, or modeling a country as a first-class record with ICountry. It doesn’t fetch or cache data at runtime; every dataset is a static, bundled constant.