Skip to content

Commit 99e9a03

Browse files
authored
🤖 Merge PR DefinitelyTyped#73973 feat(geoip-country): update types for country lookups by @prenaissance
1 parent 8972f38 commit 99e9a03

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

‎types/geoip-country/index.d.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,31 @@ export interface Lookup {
33
range: [number, number];
44
/** 2 letter ISO-3166-1 country code https://www.iban.com/country-codes */
55
country: string;
6+
/** Full country name */
7+
name?: string;
8+
/** Native country name */
9+
native?: string;
10+
/** Full capital name */
11+
capital?: string;
12+
continent?: "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
13+
continent_name?: "Africa" | "Antarctica" | "Asia" | "Europe" | "North America" | "Oceania" | "South America";
14+
/** ISO 639-1 2 letter language codes */
15+
languages?: string[];
16+
/** ISO 4217 currency codes */
17+
currency?: string[];
18+
/** Phone number prefixes */
19+
phone?: string[];
620
}
721

822
export type CmpArgs = number | [number];
923
export type CmpResult = 1 | -1 | 0 | null;
1024

1125
export function cmp(a: CmpArgs, b: CmpArgs): null | Lookup;
26+
/**
27+
* @param ip ipv4, ipv6 or "dual stack" IP (e.g. `"::ffff:8.8.8.8"`)
28+
*
29+
* @returns null for local IPs and unknown IP ranges, otherwise an object with country info
30+
*/
1231
export function lookup(ip: string | number): null | Lookup;
1332
export function pretty(ip: string | number | Array<string | number>): string;
1433
export function startWatchingDataUpdate(cb?: (err?: Error) => void): void;

‎types/geoip-country/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/geoip-country",
4-
"version": "4.0.9999",
4+
"version": "5.0.9999",
55
"projects": [
66
"https://github.com/sapics/geoip-country"
77
],

0 commit comments

Comments
 (0)