Merge pull request #13301 from EvertEt/strictnullchecks-2
Improve some null types to prepare for strictNullChecks
This commit is contained in:
@@ -127,7 +127,7 @@ class ImageSource extends Source {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
* @type {Array<number>|null}
|
||||
*/
|
||||
this.resolutions_ =
|
||||
options.resolutions !== undefined ? options.resolutions : null;
|
||||
@@ -146,7 +146,7 @@ class ImageSource extends Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {Array<number>} Resolutions.
|
||||
* @return {Array<number>|null} Resolutions.
|
||||
*/
|
||||
getResolutions() {
|
||||
return this.resolutions_;
|
||||
|
||||
@@ -87,7 +87,7 @@ class Static extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
* @type {import("../size.js").Size|null}
|
||||
*/
|
||||
this.imageSize_ = options.imageSize ? options.imageSize : null;
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ class Source extends BaseObject {
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @return {Array<number>|undefined} Resolutions.
|
||||
* @return {Array<number>|null} Resolutions.
|
||||
*/
|
||||
getResolutions() {
|
||||
return abstract();
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -827,7 +827,7 @@ class VectorSource extends Source {
|
||||
* `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.
|
||||
*
|
||||
* @param {string|number} id Feature identifier.
|
||||
* @return {import("../Feature.js").default<Geometry>} The feature (or `null` if not found).
|
||||
* @return {import("../Feature.js").default<Geometry>|null} The feature (or `null` if not found).
|
||||
* @api
|
||||
*/
|
||||
getFeatureById(id) {
|
||||
@@ -839,7 +839,7 @@ class VectorSource extends Source {
|
||||
* Get a feature by its internal unique identifier (using `getUid`).
|
||||
*
|
||||
* @param {string} uid Feature identifier.
|
||||
* @return {import("../Feature.js").default<Geometry>} The feature (or `null` if not found).
|
||||
* @return {import("../Feature.js").default<Geometry>|null} The feature (or `null` if not found).
|
||||
*/
|
||||
getFeatureByUid(uid) {
|
||||
const feature = this.uidIndex_[uid];
|
||||
|
||||
@@ -142,7 +142,7 @@ class VectorTile extends UrlTile {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../format/Feature.js").default}
|
||||
* @type {import("../format/Feature.js").default|null}
|
||||
*/
|
||||
this.format_ = options.format ? options.format : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user