In Visual Studio Code, how to install arcgis-js-api.d.ts

6074
17
10-21-2016 08:27 PM
WenhuaPeng
New Contributor

I am new to javascript. In windows  Visual Studio Code, I want to get arcgis api Intellisense , some guidebook says first install node.js and typings, then install arcgis api.

The typings tool may be used to install this using the command:
typings install --global github:Esri/jsapi-resources/4.x/typescript/arcgis-js-api.d.ts

execute above line in cmd.exe  , error  shows the location is bad.

SO how can I install arcgis-js-api.d.ts

Thanks!

0 Kudos
17 Replies
ReneRubalcava
Frequent Contributor

Thanks Robert Scheitlin, GISP‌ for the suggestion. I put together a video that starts from scratch on setting up Visual Studio Code using the ArcGIS API for JavaScript.

TypeScript and Visual Studio Code for ArcGIS API for JavaScript - YouTube 

Hopefully that provides a better picture on getting things up and running.

WenhuaPeng
New Contributor

Rene,

I follow your vedeo, step by step, npm install dojo & arcgis api, init project ......, at the step

import Map = Require("esri/map");
import FeatureLayer = Require("esri/layer/featureLayer");

still cannot get the Intellisense. Should I need some extension in VSC?

 Thank you so much!

0 Kudos
ReneRubalcava
Frequent Contributor

None of my VS Code extensions seem to matter.

What version of TypeScript are you using? You can check via tsc --version in the command line.

Did you restart VS Code?

0 Kudos
WenhuaPeng
New Contributor

tsc version 2.03, I restart VS code and the computer.

0 Kudos
GLCAdmin
New Contributor II

Hi Wenhua,

I am running into the same problem as you are. I did the same as the video tutorial and it did not work, but the following lines worked for me.

import Map = require("esri/Map");

import FeatureLayer = require("esri/layers/FeatureLayer")

Maybe because the ArcGIS JS library we are getting from npm has been updated to version 4.2, not 3.18, which may have packaged classes and objects differently?

Additionally, though these two import lines worked, I am not getting IntelliSense creating the map constant, e.g., basemap, center. Any idea?

0 Kudos
JeffJacobson
Occasional Contributor III

You can still get the 3.x version from NPM if you need it. Below is what you would type at the console to specifically install the 3.x version.

npm install --save @types/arcgis-js-api@">=3.19.0 <4"‍‍

0 Kudos
Ravichandran_M_Kaushika
Occasional Contributor

@Rene Rubalcava, and others,

good afternoon.  I see that Rene's video 'uses' TS - i just completed reading readng a few pages comparing JS vs its superset TS.

I was able to get a sample project going w TS on VS code. I got intellisense.

Does ESRI recommend TS for web app builder and the like?

thanks Mr. Rene for your nice youtube video.

regards

ravi.

0 Kudos
ZorbaConlen1
Occasional Contributor III

Hi,

I'm trying to get intellisense working in VS 2017. I have followed the steps in Rene's video, but no luck so far. 

-Used npm to install esri jsapi typings (3.25)

-Edited tsconfig.json file to include reference to typings.d.ts file

-Created typings.d.ts file with references as shown

-Confirmed packge.json exists and configured correctly

I know the video was for vs code, but assuming this can be configured similarly for VS.

Any suggestions.

Thanks

0 Kudos