I work with Arcgis JS Api 4.18
But when I try to do that, I get this error :
[esri.core.Accessor] Accessor#set Assigning an instance of 'esri.layers.support.Sublayer' which is not a subclass of 'esri.layers.Layer'
I understand what is causing this error but I would like to know how to solve this.
I've tried to get the service URL from these two sublayers and to create two new MapImageLayers on the fly but I feel that's not the right way to do it.
Could you please tell me what would be the best way to handle this issue ?