Improve some null types to prepare for strictNullChecks

This commit is contained in:
EvertEt
2022-01-30 12:15:46 +01:00
parent 12f8bae261
commit e3d3d24f05
20 changed files with 41 additions and 39 deletions
+8 -6
View File
@@ -93,14 +93,13 @@ class TileSource extends Source {
options.tilePixelRatio !== undefined ? options.tilePixelRatio : 1;
/**
* @type {import("../tilegrid/TileGrid.js").default}
* @type {import("../tilegrid/TileGrid.js").default|null}
*/
this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null;
const tileSize = [256, 256];
const tileGrid = options.tileGrid;
if (tileGrid) {
toSize(tileGrid.getTileSize(tileGrid.getMinZoom()), tileSize);
if (this.tileGrid) {
toSize(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), tileSize);
}
/**
@@ -233,9 +232,12 @@ class TileSource extends Source {
}
/**
* @return {Array<number>} Resolutions.
* @return {Array<number>|null} Resolutions.
*/
getResolutions() {
if (!this.tileGrid) {
return null;
}
return this.tileGrid.getResolutions();
}
@@ -254,7 +256,7 @@ class TileSource extends Source {
/**
* Return the tile grid of the tile source.
* @return {import("../tilegrid/TileGrid.js").default} Tile grid.
* @return {import("../tilegrid/TileGrid.js").default|null} Tile grid.
* @api
*/
getTileGrid() {