From 5cbba7c71900607415ff8d5ce346a440da3f5f11 Mon Sep 17 00:00:00 2001 From: Andrey Ilin Date: Fri, 10 Jul 2026 11:49:03 +0200 Subject: [PATCH] feat(models): add TypeScript declarations --- index.d.ts | 16 ++++++++++++++++ package-lock.json | 4 ++-- package.json | 3 ++- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..cd7c2a7 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,16 @@ +interface CountryIso { + alpha2: string; + alpha3: string; +} + +export class RegionIdentifier { + constructor(apikey: string); + + get(country: string, zipCode: string): Promise<[region: string | null, googleUsed: boolean]>; + + getNameFromCountryAndRegion(country: string, region: string): string | null; + + detectWithGoogle(countryIso: CountryIso, zipCode: string): Promise; +} + +export class GoogleMapsAPIError extends Error {} diff --git a/package-lock.json b/package-lock.json index d3d319d..4837b98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "region_identifier", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "region_identifier", - "version": "2.1.0", + "version": "2.1.1", "license": "CC BY 3.0", "dependencies": { "axios": "^1.18.1", diff --git a/package.json b/package.json index 0fcc7de..98bc4a0 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "region_identifier", - "version": "2.1.0", + "version": "2.1.1", "description": "Gets the name of the region depending of the country and zip code.", "main": "index.js", + "types": "index.d.ts", "repository": { "type": "git", "url": "https://github.com/parcelLab/regionIdentifier.git"