https://github.com/Microsoft/TypeScript/wiki/Compiler-Options
var myBetterAdd = function(label: string, ...numbers: number[]): string {
return label + ': ' + numbers.reduce((previousValue, currentValue) => {
return previousValue + currentValue;
});
}
https://github.com/Esri/jsapi-resources/tree/master/typescript
npm install dojo-typings --save-dev
{
"buildOnSave": true,
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "amd",
"target": "ES5",
"rootDir": "src",
"watch": true,
"noImplicitUseStrict": true
},
"files": [
"./src/app/main.ts",
"./src/app/MapView.ts",
"./node_modules/dojo-typings/dojo/1.11/index.d.ts",
"./node_modules/dojo-typings/dojo/1.11/modules.d.ts",
"./node_modules/dojo-typings/dijit/1.11/index.d.ts",
"./node_modules/dojo-typings/dijit/1.11/modules.d.ts",
"./node_modules/dojo-typings/dojox/1.11/index.d.ts",
"./node_modules/dojo-typings/dojox/1.11/modules.d.ts",
"./arcgis-js-api.d.ts"
]
}
import * as dojoDeclare from "dojo/_base/declare";
import * as _WidgetBase from 'dijit/_WidgetBase';
import * as _TemplatedMixin from 'dijit/_TemplatedMixin';
import * as lang from 'dojo/_base/lang';
import * as dom from 'dojo/dom';
import * as on from 'dojo/on';
/// <amd-dependency path="esri/map" name="Map"/>
/// <amd-dependency path="esri/geometry/Point" name="Point" />
/// <amd-dependency path="esri/graphic" name="Graphic" />
/// <amd-dependency path="esri/InfoTemplate" name="InfoTemplate" />
/// <amd-dependency path="esri/layers/GraphicsLayer" name="GraphicsLayer" />
/// <amd-dependency path="esri/request" name="esriRequest" />
/// <amd-dependency path="esri/symbols/PictureMarkerSymbol" name="PictureMarkerSymbol" />
declare var Map: any;
declare var GraphicsLayer: any;
declare var esriRequest: any;
declare var Point: any;
declare var PictureMarkerSymbol: any;
declare var InfoTemplate: any;
declare var Graphic: any;
ES6: (does not seem to work):
import * as dojoDeclare from "dojo/_base/declare";
import * as _WidgetBase from 'dijit/_WidgetBase';
import * as _TemplatedMixin from 'dijit/_TemplatedMixin';
import * as lang from 'dojo/_base/lang';
import * as dom from 'dojo/dom';
import * as on from 'dojo/on';
import * as Point from 'esri/geometry/Point';
import * as Graphic from 'esri/graphic';
import * as InfoTemplate from 'esri/InfoTemplate';
import * as GraphicsLayer from 'esri/layers/GraphicsLayer';
import * as Map from 'esri/map';
import * as esriRequest from 'esri/request';
import * as PictureMarkerSymbol from 'esri/symbols/PictureMarkerSymbol';
var MapView: any = dojoDeclare([_WidgetBase, _TemplatedMixin], {
export default MapView;
import MapView from './MapView';