npm install @arcgis/core
npm install @types/arcgis-js-api@latest --save-exact
Then I updated my code with the “import … from '@arcgis/core/…;” statements and modified codes as needed. When compile, it gives me “TS6200: Definitions of the following identifiers conflict with those in another file” on
So, I tried remove “arcgis-js-api” from “types” in tsconfig.app.json and tsconfig.spec.json. It now compiles.
However, when the map is being loaded, it hits a series of “TypeError: Cannot convert undefined or null to object” and gives an empty map with no layers.
Any help is appreciated. Thanks.
When using the npm packages for @arcgis/core or arcgis-js-api, you don't need to install the typings separately. They packages already include them.
As for the second error, tough to debug without a repro sample to look at. Could be an issue that the element you're using for the map container isn't ready or something else.
Thanks Rene. Do I need to uninstall the typings which I have installed separately? Is it correct for me to exclude “arcgis-js-api” from “types” in tsconfig.app.json and tsconfig.spec.json?
You can uninstall the typings and you don't need to reference them in the tsconfig files.
Although it assumes you are using the CDN and need the typings, but still no reference to them in the tsconfig.
The same goes for building an app with webpack as well.