A convenience module for importing Geometry classes when developing with
TypeScript.
For example, rather than importing geometries one at a time like this:
import Point from "esri/geometry/Point";
import Polygon from "esri/geometry/Polygon";
import Polyline from "esri/geometry/Polyline";
You can use this module to import them on a single line:
import { Point, Polygon, Polyline } from "esri/geometry";
This module also allows you to implement type guards
on geometries, making your code smarter.
import { Geometry } from "esri/geometry";
function logGeometry(geometry: Geometry): void {
if (geometry.type === "point") {
console.log("point coords: ", geometry.x, geometry.y, geometry.z);
}
else {
console.log("The value is a geometry, but isn't a point.")
}
}