Socket
Book a DemoInstallSign in
Socket

esri-javascript-api-typings

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esri-javascript-api-typings

TypeScript definitions for the ESRI javascript API for projects that don't use a module system in TypeScript.

latest
Source
npmnpm
Version
1.4.0
Version published
Maintainers
1
Created
Source

esri-javascript-api-typings

Non-AMD typescript definitions for the ESRI javascript API.

The ESRI JavaScript api type definitions that are provided by ESRI assume that you will be writing your project using AMD syntax. For some people who do not intend to write their whole project in AMD, that leaves us unable to use Esri's type definitions. This project allows you to use typings for most of the ESRI javascript api without needing to go all-in with AMD.

Installation

npm

npm install --save-dev esri-javascript-api-typings

direct

Download the corresponding version you wish to use from the dist folder of this repository, place it anywhere within your typescript project.

Usage

If you are requiring the esri modules, there is a esriTypes.[ClassName]Constructor object that you must use for these modules (i.e. esriTypes.MapConstructor) . If you are giving a variable a type, use the esriTypes.[ClassName] format (i.e. var map: esriTypes.Map = getMapFromSomewhere();).

Here is a quick example

///<reference path="node_modules/esri-javascript-api-typings/3.14/index.d.ts" />
require(["esri/map"], function(Map: esriTypes.MapConstructor){
  //indicate that the map variable is of the type esri.Map
  var map = new Map();
});

Warning

When you include these type definitions, it will appear that there are esri global objects available. Those global objects don't really exist at runtime, so you shouldn't be using them as objects. Use the normal AMD require syntax to actually interact with the api. Only use these typings to add more static type information to your already-created objects.

///<reference path="node_modules/esri-javascript-api-typings/3.14/index.d.ts" />
//DON'T do this. the global esriTypes.Map object doesn't exist, even though this will not fail compilation.
var map = new esriTypes.Map();

FAQs

Package last updated on 09 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.