<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcGIS for JS + Angular + TypeScript in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-for-js-angular-typescript/m-p/64218#M5616</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lars,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think your tsconfig.json is fine.&amp;nbsp; But I believe you also have to include&amp;nbsp; a&amp;nbsp;"types": ["arcgis-js-api"] in your tsconfig.app.json and tsconfig.spec.json&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also try to: import {loadModules} from 'esri-loader'; if you have installed the esri-loader.&amp;nbsp; And also : import esri&amp;nbsp; = __esri . Then in your class you can have the property for the MapView, something like: mapView: esri.MapView;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See Esri's github on Angular:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/angular-cli-esri-map" title="https://github.com/Esri/angular-cli-esri-map"&gt;GitHub - Esri/angular-cli-esri-map: Example Angular component for building mapping applications with the ArcGIS API for …&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this help.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 02 Feb 2020 06:50:45 GMT</pubDate>
    <dc:creator>TateM</dc:creator>
    <dc:date>2020-02-02T06:50:45Z</dc:date>
    <item>
      <title>ArcGIS for JS + Angular + TypeScript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-for-js-angular-typescript/m-p/64217#M5615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;currently we are&amp;nbsp;trying to use the ArcGIS SDK for JS inside an Angular application together with the TypeScript definitions(&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;@types/arcgis-js-api&lt;/SPAN&gt;) and are running into some compiler problems on the imports..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What we did:&lt;/P&gt;&lt;P&gt;We followed this guide to create an ArcGIS + Angular application:&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/guide/angular/" title="https://developers.arcgis.com/javascript/latest/guide/angular/" rel="nofollow noopener noreferrer" target="_blank"&gt;Angular | ArcGIS API for JavaScript 4.14&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is running fine with these imports:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;Map &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;from &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;'arcgis-js-api/Map'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;MapView &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;from &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;'arcgis-js-api/views/MapView'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Then we tried to use this guide to install the TypeScript type definitions:&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/guide/typescript-setup/" title="https://developers.arcgis.com/javascript/latest/guide/typescript-setup/" rel="nofollow noopener noreferrer" target="_blank"&gt;TypeScript - Setting up your development environment | ArcGIS API for JavaScript 4.14&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here comes the problem. We added the definitions and can see them in our node_modules/@types folder. And WebStorm can find them aswell. When we try to import Map or MapView it suggests&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;Map &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;from &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;'esri/Map'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;import &lt;/SPAN&gt;MapView &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;from &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;'esri/views/MapView'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;It gets the link to the correct file and our instances of Map and MapView got the correct properties and methods BUT the TypeScript compiler complains that it is not able to find these modules: "TS2307: Cannot find module 'esri/Map'."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We then looked at the demo project:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/jsapi-resources/tree/master/4.x/typescript/demo" title="https://github.com/Esri/jsapi-resources/tree/master/4.x/typescript/demo" rel="nofollow noopener noreferrer" target="_blank"&gt;jsapi-resources/4.x/typescript/demo at master · Esri/jsapi-resources · GitHub&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The demo project itself is working aswell, just without Angular.&lt;/P&gt;&lt;P&gt;If we look at the differences, we found some compiler differences in the tsconfig.json file which we tried but didn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What we found suspicious: the type definitions are in the folder @types/arcgis-js-api and NOT in @types/esri how it would be normally, as the modules are exported with "esri/..."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas or help would be appreciated &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Lars&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our tsconfig file:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;{&lt;BR /&gt; "compileOnSave": false,&lt;BR /&gt; "compilerOptions": {&lt;BR /&gt; "baseUrl": "./",&lt;BR /&gt; "outDir": "./dist/out-tsc",&lt;BR /&gt; "sourceMap": true,&lt;BR /&gt; "declaration": false,&lt;BR /&gt; "downlevelIteration": true,&lt;BR /&gt; "experimentalDecorators": true,&lt;BR /&gt; "module": "esnext",&lt;BR /&gt; "moduleResolution": "node",&lt;BR /&gt; "importHelpers": true,&lt;BR /&gt; "target": "es5",&lt;BR /&gt; "typeRoots": [&lt;BR /&gt; "node_modules/@types"&lt;BR /&gt; ],&lt;BR /&gt; "lib": ["dom", "es2015.promise", "es5", "es6"]&lt;BR /&gt; },&lt;BR /&gt; "angularCompilerOptions": {&lt;BR /&gt; "fullTemplateTypeCheck": true,&lt;BR /&gt; "strictInjectionParameters": true&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:27:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-for-js-angular-typescript/m-p/64217#M5615</guid>
      <dc:creator>LarsKölln</dc:creator>
      <dc:date>2021-12-10T22:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS for JS + Angular + TypeScript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-for-js-angular-typescript/m-p/64218#M5616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lars,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think your tsconfig.json is fine.&amp;nbsp; But I believe you also have to include&amp;nbsp; a&amp;nbsp;"types": ["arcgis-js-api"] in your tsconfig.app.json and tsconfig.spec.json&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also try to: import {loadModules} from 'esri-loader'; if you have installed the esri-loader.&amp;nbsp; And also : import esri&amp;nbsp; = __esri . Then in your class you can have the property for the MapView, something like: mapView: esri.MapView;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See Esri's github on Angular:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/angular-cli-esri-map" title="https://github.com/Esri/angular-cli-esri-map"&gt;GitHub - Esri/angular-cli-esri-map: Example Angular component for building mapping applications with the ArcGIS API for …&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this help.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Feb 2020 06:50:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-for-js-angular-typescript/m-p/64218#M5616</guid>
      <dc:creator>TateM</dc:creator>
      <dc:date>2020-02-02T06:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS for JS + Angular + TypeScript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-for-js-angular-typescript/m-p/64219#M5617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tate,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;huh learned something new, thank you! I didn't know there is another tsconfig file for the app. After I added the types it works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know why this is necessary? All other types are recognized by default, without adding them to the "types" list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thansk again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2020 07:48:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-for-js-angular-typescript/m-p/64219#M5617</guid>
      <dc:creator>LarsKölln</dc:creator>
      <dc:date>2020-02-03T07:48:11Z</dc:date>
    </item>
  </channel>
</rss>

