Skip to content

Commit efd0cff

Browse files
authored
Simplify unnecessary union type in turfDistance (Turfjs#2618)
1 parent 0707f84 commit efd0cff

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

packages/turf-distance/index.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
import { Point } from "geojson";
21
import { getCoord } from "@turf/invariant";
32
import { radiansToLength, degreesToRadians, Coord, Units } from "@turf/helpers";
43

54
//http://en.wikipedia.org/wiki/Haversine_formula
65
//http://www.movable-type.co.uk/scripts/latlong.html
76

87
/**
9-
* Calculates the distance between two {@link Point|points} in degrees, radians, miles, or kilometers.
8+
* Calculates the distance between two {@link Coord|coordinates} in degrees, radians, miles, or kilometers.
109
* This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.
1110
*
1211
* @name distance
13-
* @param {Coord | Point} from origin point or coordinate
14-
* @param {Coord | Point} to destination point or coordinate
12+
* @param {Coord} from origin coordinate
13+
* @param {Coord} to destination coordinate
1514
* @param {Object} [options={}] Optional parameters
1615
* @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers
17-
* @returns {number} distance between the two points
16+
* @returns {number} distance between the two coordinates
1817
* @example
1918
* var from = turf.point([-75.343, 39.984]);
2019
* var to = turf.point([-75.534, 39.123]);
@@ -28,8 +27,8 @@ import { radiansToLength, degreesToRadians, Coord, Units } from "@turf/helpers";
2827
* to.properties.distance = distance;
2928
*/
3029
function distance(
31-
from: Coord | Point,
32-
to: Coord | Point,
30+
from: Coord,
31+
to: Coord,
3332
options: {
3433
units?: Units;
3534
} = {}

0 commit comments

Comments
 (0)