Hi,
I'm trying to add a custom TileLayer to the map using the new ES modules in 4.18 but am unsure how to implement the createSubclass method on BaseTileLayer. I can see that is a dojo method so was unsure how to perform the equivalent in Typescript/Angular.
Any help would be greatly appreciated.
Here's an AMD example: https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-custom-.... There aren't any dojo methods in the 4.18 API. The way the modules functionality is implemented in ESM (POJO or TypeScript) is exactly the same as AMD, you just need to change the path used by the import statements: https://developers.arcgis.com/javascript/latest/es-modules/#migrate-to-es-modules.
Hi Andy,
I believe I have imported correctly
I can repro, that's a TypeScript definition problem, I'll open an issue. You can temporarily bypass the issue and continue your builds by using //@ts-ignore:
//@ts-ignore
var ImageLayer = BaseTileLayer.createSubclass({
I also see that the API reference documentation needs to be updated. We're looking into that, as well. Thanks for reporting.
Hi Andy, many thanks, that workaround works for now and my tile layer is now available in the map. I did find a similar issue in an older version here: https://community.esri.com/t5/arcgis-api-for-javascript/customelevationlayer-with-typescript/m-p/380...