A small TypeScript dataset of countries and phone dialing metadata.
Exports:
countries.ts— an array ofinterface.Countryobjects.interface/country.ts— the TypeScript interface describing each record.
Quick links:
countries.tsinterface/country.ts
Purpose Provide a lightweight, fully typed list of countries with:
- ISO country code (
Code) - display name (
name) - emoji flag (
flag) - international dialing code (
dialCode) - phone number
maxLengthfor validation - phone number
minLengthfor validation
API (shape)
Each item follows the interface.Country interface:
name: string— human-readable country nameCode: string— two-letter ISO country codeflag: string— emoji flagdialCode: string— international dialing prefix (e.g.+1)maxLength: number— maximum national number lengthminLength: number— minimum national number length
Usage
import type { Country } from './interface/country'
import { countries } from './countries'
const findByCode = (code: string): Country | undefined =>
countries.find(c => c.Code.toUpperCase() === code.toUpperCase())
const nigeria = findByCode('NG')
console.log(nigeria?.dialCode) // => "+234"Contributing See CONTRIBUTING.md for contribution guidelines.
License This dataset is provided under the MIT License. See LICENSE.