mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-04 07:52:51 +00:00
commit
2e01482f92
12
types/zipcodes/index.d.ts
vendored
12
types/zipcodes/index.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
// Type definitions for zipcodes 6.0
|
||||
// Type definitions for zipcodes 6.1
|
||||
// Project: https://github.com/davglass/zipcodes#readme
|
||||
// Definitions by: Brayden Lopez <https://github.com/headdetect>
|
||||
// Definitions by: Brayden Lopez <https://github.com/headdetect>, Dobes Vandermeer <https://github.com/dobesv>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace ZipCodes;
|
||||
@ -14,18 +14,18 @@ export interface ZipCode {
|
||||
country: string;
|
||||
}
|
||||
|
||||
export function lookup(zip: any): ZipCode;
|
||||
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: ZipCode, zipB: ZipCode): number;
|
||||
export function distance(zipA: string|number, zipB: string|number): number | null;
|
||||
|
||||
export function radius(zip: ZipCode, miles: number, full: boolean): string | ZipCode[];
|
||||
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): ZipCode;
|
||||
export function lookupByCoords(lat: number, lon: number): string | null;
|
||||
|
||||
@ -18,19 +18,19 @@ const zipB: ZipCodes.ZipCode = {
|
||||
country: 'US'
|
||||
};
|
||||
|
||||
ZipCodes.lookup(zipA); // $ExpectType ZipCode
|
||||
ZipCodes.lookup(zipA.zip); // $ExpectType ZipCode | undefined
|
||||
|
||||
ZipCodes.lookupByName('Cupertino', 'CA'); // $ExpectType ZipCode[]
|
||||
|
||||
ZipCodes.lookupByState('CA'); // $ExpectType ZipCode[]
|
||||
|
||||
ZipCodes.distance(zipA, zipB); // $ExpectType number
|
||||
ZipCodes.distance(zipA.zip, zipB.zip); // $ExpectType number | null
|
||||
|
||||
ZipCodes.radius(zipA, 1, true); // $ExpectType string | ZipCode[]
|
||||
ZipCodes.radius(zipA, 1, false); // $ExpectType string | ZipCode[]
|
||||
ZipCodes.radius(zipA.zip, 1, true); // $ExpectType ZipCode[] | string[]
|
||||
ZipCodes.radius(zipA.zip, 1, false); // $ExpectType ZipCode[] | string[]
|
||||
|
||||
ZipCodes.toMiles(3); // $ExpectType number
|
||||
|
||||
ZipCodes.toKilometers(3); // $ExpectType number
|
||||
|
||||
ZipCodes.lookupByCoords(37.323, -122.0527); // $ExpectType ZipCode
|
||||
ZipCodes.lookupByCoords(37.323, -122.0527); // $ExpectType string | null
|
||||
|
||||
Loading…
Reference in New Issue
Block a user