diff --git a/types/haversine/haversine-tests.ts b/types/haversine/haversine-tests.ts index 2bfac64856..5c068ea4b3 100644 --- a/types/haversine/haversine-tests.ts +++ b/types/haversine/haversine-tests.ts @@ -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 }; diff --git a/types/haversine/index.d.ts b/types/haversine/index.d.ts index d828b8eb5a..5f6d1e9173 100644 --- a/types/haversine/index.d.ts +++ b/types/haversine/index.d.ts @@ -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 { /**