From e71e64cdaad9d0823c7f64dde7ac4bac4ee446c1 Mon Sep 17 00:00:00 2001 From: phiresky Date: Thu, 2 Apr 2020 19:32:13 +0200 Subject: [PATCH] better geoip-lite lookup type (#43575) --- types/geoip-lite/index.d.ts | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/types/geoip-lite/index.d.ts b/types/geoip-lite/index.d.ts index 38d6683ba2..174a4644b4 100644 --- a/types/geoip-lite/index.d.ts +++ b/types/geoip-lite/index.d.ts @@ -3,14 +3,34 @@ // Definitions by: Yuce Tekol // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace mod { + /** + * https://github.com/bluesmoon/node-geoip#looking-up-an-ip-address + */ export interface Lookup { - range: Array; // range start, end + /** [ , ] */ + range: [number, number]; + /** 2 letter ISO-3166-1 country code https://www.iban.com/country-codes */ country: string; + /** + * Up to 3 alphanumeric variable length characters as ISO 3166-2 code + * For US states this is the 2 letter state + * For the United Kingdom this could be ENG as a country like “England + * FIPS 10-4 subcountry code + */ region: string; + /** 1 if the country is a member state of the European Union, 0 otherwise. */ + eu: '1' | '0'; + /** "Country/Zone" Timezone from IANA Time Zone Database */ + timezone: string; + /** This is the full city name */ city: string; - ll: Array; // latitude, longitude + /** The latitude and longitude of the city */ + ll: [number, number]; + /** Metro code */ + metro: number; + /** The approximate accuracy radius (km), around the latitude and longitude */ + area: number; } export function lookup(ip: string): null | Lookup;