HashMap

HashMap is a type in TypeScript that represents a collection of key-value pairs. It is similar to a dictionary in Python or an object in JavaScript. HashMap is used to store data in a key-value format. It is a generic type, which means that you can specify the type of the key and the value when you create an instance of the class.

Usage

You can find usage of the HashMap type in the ArcGIS API for JavaScript SDK where property types, method parameters, and return types are defined as the HashMap type.

HashMap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * Construct a type with a set of properties K of type T
 *
 * typescript/lib/lib.es5.d.ts
 */
type Record<K extends keyof any, T> = {
    [P in K]: T;
};

/**
 * A HashMap is an object with string keys
 * that can have values of a certain type.
 * In simplest terms, it is a collection of key-value pairs.
 *
 * arcgis-js-api-4.32.d.ts
 */
type HashMap<T> = Record<string, T>;

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

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close