File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
packages/turf-nearest-point Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 1- import { Feature , FeatureCollection , Point } from "geojson" ;
1+ import { Feature , FeatureCollection , GeoJsonProperties , Point } from "geojson" ;
22import { Coord , Units } from "@turf/helpers" ;
33import { clone } from "@turf/clone" ;
44import { distance } from "@turf/distance" ;
55import { featureEach } from "@turf/meta" ;
66
7- interface NearestPoint extends Feature < Point > {
7+ interface NearestPoint < P extends GeoJsonProperties = GeoJsonProperties >
8+ extends Feature < Point > {
89 properties : {
910 featureIndex : number ;
1011 distanceToPoint : number ;
11- [ key : string ] : any ;
12- } ;
12+ } & P ;
1313}
1414
1515/**
@@ -38,13 +38,13 @@ interface NearestPoint extends Feature<Point> {
3838 * var addToMap = [targetPoint, points, nearest];
3939 * nearest.properties['marker-color'] = '#F00';
4040 */
41- function nearestPoint (
41+ function nearestPoint < P extends GeoJsonProperties = GeoJsonProperties > (
4242 targetPoint : Coord ,
43- points : FeatureCollection < Point > ,
43+ points : FeatureCollection < Point , P > ,
4444 options : {
4545 units ?: Units ;
4646 } = { }
47- ) : NearestPoint {
47+ ) : NearestPoint < P > {
4848 // Input validation
4949 if ( ! targetPoint ) throw new Error ( "targetPoint is required" ) ;
5050 if ( ! points ) throw new Error ( "points is required" ) ;
You can’t perform that action at this time.
0 commit comments