mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
haversine: explictly declare LongtitudeLatitude and LonLat interfaces
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import haversine = require('haversine');
|
||||
|
||||
const start = {
|
||||
const start: haversine.CoordinateLongitudeLatitude = {
|
||||
longitude: 48.1548256,
|
||||
latitude: 11.4017529
|
||||
};
|
||||
|
||||
const end = {
|
||||
const end: haversine.CoordinateLongitudeLatitude = {
|
||||
longitude: 52.5065133,
|
||||
latitude: 13.1445551
|
||||
};
|
||||
@@ -17,12 +17,12 @@ const options: haversine.Options = {
|
||||
|
||||
haversine(start, end, options);
|
||||
|
||||
const startShort = {
|
||||
const startShort: haversine.CoordinateLonLat = {
|
||||
lon: 48.1548256,
|
||||
lat: 11.4017529
|
||||
};
|
||||
|
||||
const endShort = {
|
||||
const endShort: haversine.CoordinateLonLat = {
|
||||
lon: 52.5065133,
|
||||
lat: 13.1445551
|
||||
};
|
||||
|
||||
Vendored
+11
-7
@@ -4,6 +4,16 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace haversine {
|
||||
interface CoordinateLongitudeLatitude {
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
}
|
||||
|
||||
interface CoordinateLonLat {
|
||||
lon: number;
|
||||
lat: number;
|
||||
}
|
||||
|
||||
type LatLonTuple = [number, number];
|
||||
|
||||
interface GeoJSON {
|
||||
@@ -12,13 +22,7 @@ declare namespace haversine {
|
||||
};
|
||||
}
|
||||
|
||||
type Coordinate = ({
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
} | {
|
||||
lat: number;
|
||||
lon: number;
|
||||
} | LatLonTuple | GeoJSON);
|
||||
type Coordinate = (CoordinateLongitudeLatitude | CoordinateLonLat | LatLonTuple | GeoJSON);
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user