Select to view content in your preferred language

ArcGIS Maps SDK for JavaScript 5.0

812
6
Jump to solution
02-20-2026 12:49 PM
ForrestLin
Frequent Contributor

ArcGIS Maps SDK for JavaScript 5.0 is release. Please update the documents:

https://developers.arcgis.com/javascript/latest

1 Solution
6 Replies
Noah-Sager
Esri Regular Contributor

Hi @ForrestLin, thanks for your post, and thanks for paying such close attention to our releases! We are in the final stages of our release process, and we usually don't update our documentation until the official announcement goes out. Please stay tuned for our release announcements (coming this week), both on the ArcGIS Blog site and on this site.

timtucker-dte
Emerging Contributor

Seeing issues with the Typescript definitions for attributes on arcgis-map.

/** 
 * This gives a type error for Geometry because the signature for Feature | Point can't handle partial values 
 * Note: the value for constraints is taken directly from documentation
 **/ 
const testMap1 = (
	 <arcgis-map constraints={
		{
			geometry: { // Constrain lateral movement to Lower Manhattan 
				type: 'extent', 
				xmin: -74.02, 
				ymin: 40.7, 
				xmax: -73.971, 
				ymax: 40.73, 
			}, 
			minScale: 500000, // User cannot zoom out beyond a scale of 1:500,000 
			maxScale: 0, // User can overzoom tiles 
			rotationEnabled: false, // Disables map rotation
		}
		} /> 
);
/**
 * Defining the constraints object separately gives type safety for the object, but then gives a type error when we try to use it in the map component 
 * In this case, the issue is that MapViewConstraints treats optional fields as required
 **/
const testConstraints: MapViewConstraintsProperties = { 
	geometry: 
	{ // Constrain lateral movement to Lower Manhattan 
	type: 'extent', 
	xmin: -74.02, 
	ymin: 40.7, 
	xmax: -73.971, 
	ymax: 40.73, 
}, 
minScale: 500000, // User cannot zoom out beyond a scale of 1:500,000
maxScale: 0, // User can overzoom tiles
rotationEnabled: false, // Disables map rotation
};
const testMap2 = <arcgis-map constraints={testConstraints} />;

/**
 * Coercing the type works, but we shouldn't have to do this 
 **/
const testMap3 = <arcgis-map constraints={testConstraints as MapViewConstraints} />;
0 Kudos
mpatiiuk
Esri Contributor

Hi,

The following is the recommended pattern when working with map components:

import MapViewConstraints from "@arcgis/core/views/2d/MapViewConstraints.js";
const constraints = new MapViewConstraints({
  geometry: {
    type: "extent",
    xmin: -74.02,
    ymin: 40.7,
    xmax: -73.971,
    ymax: 40.73,
  },
  minScale: 500000,
  maxScale: 0,
  rotationEnabled: false,
});
const arcgisMap = <arcgis-map constraints={constraints} />;

If working in frameworks like React, ensure the `constraints` object is stable between re-renders by using useRef or useEffect. Avoid re-creating the `constraints` object on each re-render as that will cause the map to flicker.

Note: the value for constraints is taken directly from documentation

The documentation will be updated to show the above pattern. Thank you for reporting the issue!

Noah-Sager
Esri Regular Contributor

@timtucker-dte - thanks for the post. The typings changed here a bit it looks like. Can you check the doc and see if this makes things more clear?

contraints example:
https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-map/#con...

type:

https://developers.arcgis.com/javascript/latest/references/core/views/2d/MapViewConstraints/

0 Kudos
timtucker-dte
Emerging Contributor

@Noah-Sager the examples I gave above all used JSON for the view definition from the docs verbatim.

The only difference vs. the docs example is attempting to pass the constraints via the constraints attribute on an arcgis-map tag directly vs. programmatically changing settings on the view instance.

The broader issue I see across the SDK: in many places you can pass either an instance of class "Foo" or a JSON object that's typed as Partial<Foo>.  That leads to type errors on tags like arcgis-map that are expecting Foo as an attribute instead of Partial<Foo>.