# @types/iso-3166-2

> TypeScript definitions for iso-3166-2

Latest version **1.0.4** (published 2025-07-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/iso-3166-2
pnpm add @types/iso-3166-2
yarn add @types/iso-3166-2
bun add @types/iso-3166-2
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2025-07-11 |
| First published | 2017-08-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51445 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/iso-3166-2
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/iso-3166-2
- npm.io page: https://npm.io/package/@types/iso-3166-2

## Recent versions

- 1.0.4 (latest) — 2025-07-11
- 1.0.3 (ts4.5) — 2023-11-07
- 1.0.0 (ts2.8) — 2020-01-23
- 0.6.0 (ts2.0) — 2017-08-03
- 1.0.2 — 2023-10-18
- 1.0.1 — 2023-09-26

## README

# Installation
> `npm install --save @types/iso-3166-2`

# Summary
This package contains type definitions for iso-3166-2 (https://github.com/olahol/iso-3166-2.js).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/iso-3166-2.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/iso-3166-2/index.d.ts)
````ts
export namespace CountryInfo {
    interface Partial {
        name: string;
        sub: SubdivisionInfo.Map;
    }
    interface Full extends Partial {
        code: string;
    }

    interface Map {
        // full data if this country has been retrieved with country() at least once
        [code: string]: Full | Partial;
    }
}
export type CountryInfo = CountryInfo.Full;

export namespace SubdivisionInfo {
    interface Partial {
        type: string;
        name: string;
    }
    interface Full extends Partial {
        countryName: string;
        countryCode: string;
        code: string;
        regionCode: string;
    }

    interface Map {
        // full data if this subdivision has been retrieved with subdivision() at least once
        [code: string]: Full | Partial;
    }
}
export type SubdivisionInfo = SubdivisionInfo.Full;

export function subdivision(
    countryCodeOrFullSubdivisionCode: string,
    subdivisionCodeOrName?: string,
): SubdivisionInfo | null;

export function country(countryCodeOrName: string): CountryInfo | null;

export const data: CountryInfo.Map;

// map of alpha 3 codes to alpha 2 codes
export const codes: {
    [alpha3: string]: string;
};

````

### Additional Details
 * Last updated: Fri, 11 Jul 2025 18:41:32 GMT
 * Dependencies: none

# Credits
These definitions were written by [Matt Rollins](https://github.com/sicilica), and [Emily Klassen](https://github.com/forivall).

---
_Source: https://npm.io/package/@types/iso-3166-2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
