AMD: require(["esri/geometry"], (geometry) => { /* code goes here */ });
ESM: import * as geometry from "@arcgis/core/geometry.js";
Object: esri/geometry
Since: ArcGIS Maps SDK for JavaScript 4.6

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") {
    // new at 4.6, the compiler knows the geometry is a Point instance
    console.log("point coords: ", geometry.x, geometry.y, geometry.z);
  else {
    // the compiler knows the geometry must be a `Extent | Polygon | Multipoint | Polyline`
    console.log("The value is a geometry, but isn't a point.")

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.