ImageryProvider provider error Property 'xxxx' does not exist on type 'typeof Cesium'

1. A concise explanation of the problem you’re experiencing.

We are using Cesium in a web-based application, developed in Typescript. However, we have issues when trying to add some (not all) imagery providers. The providers that are failing are:

MapboxImageryProvider

OpenStreetMapImageryProvider

And the error we get is:

Property ‘OpenStreetMapImageryProvider’ does not exist on type ‘typeof Cesium’.ts(2339)

However, these imagery providers work:

IonImageryProvider

layers.addImageryProvider(new Cesium.ArcGisMapServerImageryProvider({

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Failing:

layers.addImageryProvider(new MapboxImageryProvider({

mapId: ‘mapbox.streets’,

accessToken: ‘https://api.mapbox.com/styles/v1/cbredesign/ck5xudjn53ce81iloz3cdyetp.html?fresh=true&title=copy&access_token=pk.eyJ1IjoiY2JyZWRlc2lnbiIsImEiOiIyZDY3OGRmYzk3NDQ5MWMwMDE5YWQ0Y2UxOWE5MWM3MCJ9.9rRnrrli22cqtEJDBKTrxQ

}));

Error msg: Property ‘MapboxImageryProvider’ does not exist on type ‘typeof Cesium’. Did you mean ‘BingMapsImageryProvider’?ts(2551)

Working ok:

layers.addImageryProvider(new Cesium.IonImageryProvider({ assetId: typeMap === ‘satelite’ ? 4 : 2 }))

layers.addImageryProvider(new Cesium.ArcGisMapServerImageryProvider({

url : ‘https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer

}))

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

We want to offer to the user the ability to use different base map layers from different providers.

4. The Cesium version you’re using, your operating system and browser.

“cesium”: “^1.57.0”,

@types/cesium”: “^1.54.4”,

Note that Cesium 1.57 is 9 months old. Be sure to check the documentation for the actual version you are using. This API changed in Cesium 1.62. In older versions, use createOpenStreetMapImageryProvider.

https://cesium.com/downloads/cesiumjs/releases/1.57/Build/Documentation/createOpenStreetMapImageryProvider.html