Select to view content in your preferred language

How do you access all types via ESM import in @arcgis/core

745
2
04-18-2023 01:26 PM
RussellMGreen
Emerging Contributor

When using the `arcgis/core` library, how do you gain access to all of the interface types (that aren't explicitly classes)? For example: `EditResult` or `SpatialReferenceProperties`, etc.

In previous versions, Esri recommended doing:

 

import Esri = __esri;

const result:Esri.EditsResult = await layer.applyEdits(...);

 

 

However, since the latest JS version Esri has recommended against doing this and instead recommends pulling the types via ESM modules:

 

import type WebMap from "@arcgis/core/WebMap.js";

 

 

However, that doesn't work for interfaces/types that aren't defined as classes.

 

How should we gain access to all of the ArcGIS JS API types (interfaces/types/etc.) in "@arcgis/core" library?

2 Replies
AndyGup
Esri Regular Contributor

Hi @RussellMGreen unfortunately we don't currently have a way to export interfaces and other types. You will still need to use the __esri namespace for gaining access to most items that are not classes. We do have an issue open for improving this in the future.

UmutUcok
New Contributor
0 Kudos