haversine: explictly declare LongtitudeLatitude and LonLat interfaces

This commit is contained in:
Daniel Hritzkiv
2017-11-16 11:05:39 -05:00
parent fec98c71f8
commit a5417f724c
2 changed files with 15 additions and 11 deletions
+4 -4
View File
@@ -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
};
+11 -7
View File
@@ -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 {
/**