How To Integrate Dojo, TypeScript, and the ArcGIS API within Visual Studio

In Visual Studio 2015, I'm trying to integrate the Dojo framework, TypeScript, and a third party JavaScript API by a company called ESRI.
ESRI's "JavaScript API for ArcGIS" is built upon the Dojo framework. I'm requesting assistance in getting those technologies to work together.

To get started, I used Visual Studio's NuGet Package Manager to install :
1. dojo.TypeScript.DefinitelyTyped
2. arcgis-js-api.TypeScript.DefinitelyTyped

I figured that since ESRI's ArcGIS JavaScript API is built from Dojo, I would need DefinitelyTyped packages for Dojo also.

I am a novice to TypeScript, Dojo, and ESRI's API. So, detailed explanations are appreciated.

In my PipelineMap.ts file, I have the following path references at the top of the page :
/// <reference path="scripts/typings/dojo/dojo.d.ts" />
/// <reference path="scripts/typings/dojo/dijit.d.ts" />
/// <reference path="scripts/typings/arcgis-js-api/arcgis-js-api.d.ts" />

Open in new window


The code in that file includes this :

require(
	["esri/map", "esri/layers/ArcGISDynamicMapServiceLayer", "dojo/domReady!"],
	function (Map, ArcGISDynamicMapServiceLayer) {
. . . 
});

Open in new window


In the code above, the keyword, "function" has a red, squigly, error line below it. Hovering my mouse over that line displays the following error message :      

Argument of type '(Map: any, ArcGISDynamicMapServiceLayer: any) => void' is not assignable to parameter of type 'String[]'.
Property 'push' is missing in type '(Map: any, ArcGISDynamicMapServiceLayer: any) => void'.

The code above works fine when run from a regular JavaScript *.js file.

########################################################################

In a different TypeScript file, I have the following path references and amd-dependency paths :

/// <reference path="scripts/typings/dojo/dojo.d.ts" />
/// <reference path="scripts/typings/dojo/dijit.d.ts" />
/// <reference path="scripts/typings/arcgis-js-api/arcgis-js-api.d.ts" />

/// <amd-dependency path="dojo/text!./_templates/Foo.html" />
/// <amd-dependency path="dojo/_base/declare" name="dojoDeclare"/> 
/// <amd-dependency path="dojo/i18n!app/common/nls/resources" />
/// <amd-dependency path="dojo/text!./templates/LocatorView.html" name="templateString"/> 

/// <amd-dependency path="dijit/form/TextBox" />
/// <amd-dependency path="dijit/_WidgetBase" name="_WidgetBase"/> 
/// <amd-dependency path="dijit/_TemplatedMixin" name="_TemplatedMixin"/> 

/// <amd-dependency path="dbind/bind" name="bind"/> 

/// <amd-dependency path="esri/layers/ArcGISDynamicMapServiceLayer" name="ArcGISDynamicMapServiceLayer" />
/// <amd-dependency path="esri/map" name="Map"/>

Open in new window


The code in that TypeScript file includes the following :
require(
    [
        "dojo/dom-construct",
        "esri/Color",
        "esri/dijit/Geocoder",
        "esri/dijit/Popup",
        "esri/InfoTemplate",
        "esri/layers/ArcGISDynamicMapServiceLayer",
        "esri/map",
        "esri/symbols/SimpleFillSymbol",
        "esri/symbols/SimpleLineSymbol", "dojo/domReady!"
    ],
    function (
        DomConstruct, Color, Geocoder, Popup, InfoTemplate,
        ArcGISDynamicMapServiceLayer: any, Map, SimpleFillSymbol, SimpleLineSymbol) {
    . . .
});

Open in new window


In the code above, the keyword, "function" has a red, squigly, error line below it. Hovering my mouse over that line displays the following error message :

Argument of type '(DomConstruct: any, Color: any, Geocoder: any, Popup: any, InfoTemplate: any, ArcGISDynamicMapSer...' is not assignable to parameter of type 'String[]'.
Property 'push' is missing in type '(DomConstruct: any, Color: any, Geocoder: any, Popup: any, InfoTemplate: any, ArcGISDynamicMapSer...'.      

I don't know what an amd-dependency is. I only included those because I was trying to imitate some examples I've seen on other sites.      
Hopefully, integrating Dojo, ESRI's API, and TypeScript won't be overly cumbersome and complicated. It would be nice to be able to leverage TypeScript's potential advantages.
XTOAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

XTOAuthor Commented:
I found an example of how to do this here:
https://github.com/Esri/jsapi-resources/tree/master/typescript

Basically, I add just the following reference to the top of each TypeScript file:
/// <reference path="../arcgis-js-api.d.ts"/>

And I don't include any dojo.TypeScript.DefinitelyTyped packages.

Then use an "import" command to declare the required variables. The URL above has examples.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.