mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
The typings didn't match the library. * `lookup` takes a `string` (or a `number` if you so choose): https://github.com/davglass/zipcodes/blob/master/lib/index.js#L13 * `distance` takes two `string`s, not `ZipCode` objects: https://github.com/davglass/zipcodes/blob/master/lib/index.js#L56 * similarly, `radius` takes a string rather than a `ZipCode` object, and always returns an array (of `string`s or `ZipCode` objects): https://github.com/davglass/zipcodes/blob/master/lib/index.js#L80 * Many return values are optional, with `null` or `undefined` returned for an invalid input.
32 lines
1005 B
TypeScript
32 lines
1005 B
TypeScript
// Type definitions for zipcodes 6.1
|
|
// Project: https://github.com/davglass/zipcodes#readme
|
|
// Definitions by: Brayden Lopez <https://github.com/headdetect>, Dobes Vandermeer <https://github.com/dobesv>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
export as namespace ZipCodes;
|
|
|
|
export interface ZipCode {
|
|
zip: string;
|
|
latitude: number;
|
|
longitude: number;
|
|
city: string;
|
|
state: string;
|
|
country: string;
|
|
}
|
|
|
|
export function lookup(zip: string|number): ZipCode | undefined;
|
|
|
|
export function lookupByName(city: string, state: string): ZipCode[];
|
|
|
|
export function lookupByState(state: string): ZipCode[];
|
|
|
|
export function distance(zipA: string|number, zipB: string|number): number | null;
|
|
|
|
export function radius(zip: string|number, miles: number, full: boolean): string[] | ZipCode[];
|
|
|
|
export function toMiles(kilos: number): number;
|
|
|
|
export function toKilometers(miles: number): number;
|
|
|
|
export function lookupByCoords(lat: number, lon: number): string | null;
|