Skip to content

Type Alias: CountryAlpha2

ts
type CountryAlpha2 = (typeof CountryAlpha2)[number];

Type representing any valid ISO 3166-1 alpha-2 country code.

This creates a union type of all two-letter country codes, providing type safety when working with alpha-2 codes.

Example

typescript
const countryCode: CountryAlpha2 = "US"; // ✓ Valid
const invalidCode: CountryAlpha2 = "ZZ"; // ✗ TypeScript error