@@ -1546,9 +1546,9 @@ function findSegment<
15461546 properties = properties || geojson . properties ;
15471547 geometry = geojson . geometry ;
15481548 break ;
1549- case "Point" :
1550- case "MultiPoint" :
1551- return null ;
1549+ case "Point" as any :
1550+ case "MultiPoint" as any :
1551+ return null as any ;
15521552 case "LineString" :
15531553 case "Polygon" :
15541554 case "MultiLineString" :
@@ -1560,12 +1560,12 @@ function findSegment<
15601560 }
15611561
15621562 // Find SegmentIndex
1563- if ( geometry === null ) return null ;
1563+ if ( geometry === null ) return null as any ;
15641564 var coords = geometry . coordinates ;
15651565 switch ( geometry . type ) {
1566- case "Point" :
1567- case "MultiPoint" :
1568- return null ;
1566+ case "Point" as any :
1567+ case "MultiPoint" as any :
1568+ return null as any ;
15691569 case "LineString" :
15701570 if ( segmentIndex < 0 ) segmentIndex = coords . length + segmentIndex - 1 ;
15711571 return lineString (
@@ -1706,7 +1706,7 @@ function findPoint<
17061706 break ;
17071707 case "Point" :
17081708 case "MultiPoint" :
1709- return null ;
1709+ return null as any ;
17101710 case "LineString" :
17111711 case "Polygon" :
17121712 case "MultiLineString" :
@@ -1718,39 +1718,74 @@ function findPoint<
17181718 }
17191719
17201720 // Find Coord Index
1721- if ( geometry === null ) return null ;
1722- var coords = geometry . coordinates ;
1721+ if ( geometry === null ) return null as any ;
1722+ var coords = (
1723+ geometry as
1724+ | Point
1725+ | LineString
1726+ | Polygon
1727+ | MultiPoint
1728+ | MultiLineString
1729+ | MultiPolygon
1730+ ) . coordinates ;
17231731 switch ( geometry . type ) {
17241732 case "Point" :
1725- return point ( coords , properties , options ) ;
1733+ return point ( coords as Point [ "coordinates" ] , properties , options ) ;
17261734 case "MultiPoint" :
17271735 if ( multiFeatureIndex < 0 )
17281736 multiFeatureIndex = coords . length + multiFeatureIndex ;
1729- return point ( coords [ multiFeatureIndex ] , properties , options ) ;
1737+ return point (
1738+ ( coords as MultiPoint [ "coordinates" ] ) [ multiFeatureIndex ] ,
1739+ properties ,
1740+ options
1741+ ) ;
17301742 case "LineString" :
17311743 if ( coordIndex < 0 ) coordIndex = coords . length + coordIndex ;
1732- return point ( coords [ coordIndex ] , properties , options ) ;
1744+ return point (
1745+ ( coords as LineString [ "coordinates" ] ) [ coordIndex ] ,
1746+ properties ,
1747+ options
1748+ ) ;
17331749 case "Polygon" :
17341750 if ( geometryIndex < 0 ) geometryIndex = coords . length + geometryIndex ;
17351751 if ( coordIndex < 0 )
1736- coordIndex = coords [ geometryIndex ] . length + coordIndex ;
1737- return point ( coords [ geometryIndex ] [ coordIndex ] , properties , options ) ;
1752+ coordIndex =
1753+ ( coords as Polygon [ "coordinates" ] ) [ geometryIndex ] . length + coordIndex ;
1754+ return point (
1755+ ( coords as Polygon [ "coordinates" ] ) [ geometryIndex ] [ coordIndex ] ,
1756+ properties ,
1757+ options
1758+ ) ;
17381759 case "MultiLineString" :
17391760 if ( multiFeatureIndex < 0 )
17401761 multiFeatureIndex = coords . length + multiFeatureIndex ;
17411762 if ( coordIndex < 0 )
1742- coordIndex = coords [ multiFeatureIndex ] . length + coordIndex ;
1743- return point ( coords [ multiFeatureIndex ] [ coordIndex ] , properties , options ) ;
1763+ coordIndex =
1764+ ( coords as MultiLineString [ "coordinates" ] ) [ multiFeatureIndex ] . length +
1765+ coordIndex ;
1766+ return point (
1767+ ( coords as MultiLineString [ "coordinates" ] ) [ multiFeatureIndex ] [
1768+ coordIndex
1769+ ] ,
1770+ properties ,
1771+ options
1772+ ) ;
17441773 case "MultiPolygon" :
17451774 if ( multiFeatureIndex < 0 )
17461775 multiFeatureIndex = coords . length + multiFeatureIndex ;
17471776 if ( geometryIndex < 0 )
1748- geometryIndex = coords [ multiFeatureIndex ] . length + geometryIndex ;
1777+ geometryIndex =
1778+ ( coords as MultiPolygon [ "coordinates" ] ) [ multiFeatureIndex ] . length +
1779+ geometryIndex ;
17491780 if ( coordIndex < 0 )
17501781 coordIndex =
1751- coords [ multiFeatureIndex ] [ geometryIndex ] . length - coordIndex ;
1782+ ( coords as MultiPolygon [ "coordinates" ] ) [ multiFeatureIndex ] [
1783+ geometryIndex
1784+ ] . length - coordIndex ;
17521785 return point (
1753- coords [ multiFeatureIndex ] [ geometryIndex ] [ coordIndex ] ,
1786+ ( coords as MultiPolygon [ "coordinates" ] ) [ multiFeatureIndex ] [
1787+ geometryIndex
1788+ ] [ coordIndex ] ,
17541789 properties ,
17551790 options
17561791 ) ;
0 commit comments