From a5ddac3b5a09d39cd31329bf93436472d55d64d8 Mon Sep 17 00:00:00 2001 From: James Hamilton Date: Sun, 25 Jul 2021 08:06:34 +0900 Subject: [PATCH] cast type of else statement - might work better with type guard --- src/source/raster_dem_tile_worker_source.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/source/raster_dem_tile_worker_source.ts b/src/source/raster_dem_tile_worker_source.ts index f56a6b5e10..1b5696a8fe 100644 --- a/src/source/raster_dem_tile_worker_source.ts +++ b/src/source/raster_dem_tile_worker_source.ts @@ -1,6 +1,5 @@ import DEMData from '../data/dem_data'; import {RGBAImage} from '../util/image'; -import window from '../util/window'; import type Actor from '../util/actor'; import type { @@ -8,7 +7,6 @@ import type { WorkerDEMTileCallback, TileParameters } from './worker_source'; -const {ImageBitmap} = window; class RasterDEMTileWorkerSource { actor: Actor; @@ -25,7 +23,7 @@ class RasterDEMTileWorkerSource { loadTile(params: WorkerDEMTileParameters, callback: WorkerDEMTileCallback) { const {uid, encoding, rawImageData} = params; // Main thread will transfer ImageBitmap if offscreen decode with OffscreenCanvas is supported, else it will transfer an already decoded image. - const imagePixels = (ImageBitmap && rawImageData instanceof ImageBitmap) ? this.getImageData(rawImageData) : rawImageData; + const imagePixels = (ImageBitmap && rawImageData instanceof ImageBitmap) ? this.getImageData(rawImageData) : rawImageData as RGBAImage; const dem = new DEMData(uid, imagePixels, encoding); this.loaded = this.loaded || {}; this.loaded[uid] = dem;