docs: improve typing

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

View file

@ -1,6 +1,7 @@
import * as turf from "@turf/turf"
import { TileRange, Tiles } from "../Models/TileRange"
import { GeoOperations } from "./GeoOperations"
import { Feature, Polygon } from "geojson"
export class BBox {
static global: BBox = new BBox([
@ -185,11 +186,16 @@ export class BBox {
]
}
asGeoJson(properties: any): any {
public asGeoJson<T>(properties: T): Feature<Polygon, T> {
return {
type: "Feature",
properties: properties,
geometry: {
geometry: this.asGeometry(),
}
}
public asGeometry(): Polygon {
return {
type: "Polygon",
coordinates: [
[
@ -200,7 +206,6 @@ export class BBox {
[this.minLon, this.minLat],
],
],
},
}
}