On the documentation it's written that the Map class is autocasted for MapView class.
However, when Map module isn't imported in the beginning of the code with "esri/map", it doesn't seem to work. Am I misunderstanding how autocast works or is this a bug?
Solved! Go to Solution.
Is there a particular way you're trying to create the map that doesn't work? I tried this basic example and the map works.
require(["esri/views/MapView"], (MapView) => {
const view = new MapView({
container: "viewDiv",
map: {
basemap: "topo-vector"
},
zoom: 4,
center: [15, 65]
});
});
Is there a particular way you're trying to create the map that doesn't work? I tried this basic example and the map works.
require(["esri/views/MapView"], (MapView) => {
const view = new MapView({
container: "viewDiv",
map: {
basemap: "topo-vector"
},
zoom: 4,
center: [15, 65]
});
});
Oh my bad..
My code was like below
require(["esri/view/MapView"], (MapView) => {
cost view = new MapView({
container: "viewDiv",
map: new Map({
basemap: "topo-vector"
},
zoom: 4,
center: [15, 65]
});
});
so when it's autocasted, there's no need to crate a new instance of the class and just provide the object with correct properties?
That is correct. In some cases you need to provide a "type", like for renderers, symbols, geometry, etc. Those cases should be in the doc .