docs: improve typing

This commit is contained in:
Pieter Vander Vennet 2023-03-11 02:35:11 +01:00
parent 750a0620e9
commit e9797fbd39

View file

@ -234,10 +234,11 @@ export class GeoOperations {
})
}
static bbox(feature: any) {
static bbox(feature: any): Feature<LineString, {}> {
const [lon, lat, lon0, lat0] = turf.bbox(feature)
return {
type: "Feature",
properties: {},
geometry: {
type: "LineString",
coordinates: [
@ -652,7 +653,7 @@ export class GeoOperations {
public static clipWith(toSplit: Feature, boundary: Feature<Polygon>): Feature[] {
if (toSplit.geometry.type === "Point") {
const p = <Feature<Point>>toSplit
if (GeoOperations.inside(p.geometry.coordinates, boundary)) {
if (GeoOperations.inside(<[number, number]>p.geometry.coordinates, boundary)) {
return [p]
} else {
return []
@ -687,7 +688,7 @@ export class GeoOperations {
x: number,
y: number,
coordinates: [number, number][][]
) {
): boolean {
const inside = GeoOperations.pointWithinRing(
x,
y,