diff --git a/src/ol/control/ZoomToExtent.js b/src/ol/control/ZoomToExtent.js index d883244cd6..76933eaddd 100644 --- a/src/ol/control/ZoomToExtent.js +++ b/src/ol/control/ZoomToExtent.js @@ -38,7 +38,7 @@ class ZoomToExtent extends Control { }); /** - * @type {?import("../extent.js").Extent} + * @type {?import("../extent.js").Extent|null} * @protected */ this.extent = options.extent ? options.extent : null; diff --git a/src/ol/dom.js b/src/ol/dom.js index 8134220939..84f68d9fe9 100644 --- a/src/ol/dom.js +++ b/src/ol/dom.js @@ -83,7 +83,7 @@ export function replaceNode(newNode, oldNode) { /** * @param {Node} node The node to remove. - * @return {Node} The node that was removed or null. + * @return {Node|null} The node that was removed or null. */ export function removeNode(node) { return node && node.parentNode ? node.parentNode.removeChild(node) : null; diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index dbdf15cbf5..1b061c80c5 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -80,7 +80,7 @@ class MVT extends FeatureFormat { /** * @private - * @type {Array} + * @type {Array|null} */ this.layers_ = options.layers ? options.layers : null; diff --git a/src/ol/format/WMSGetFeatureInfo.js b/src/ol/format/WMSGetFeatureInfo.js index b1e2f97658..65e4a54f01 100644 --- a/src/ol/format/WMSGetFeatureInfo.js +++ b/src/ol/format/WMSGetFeatureInfo.js @@ -54,20 +54,20 @@ class WMSGetFeatureInfo extends XMLFeature { /** * @private - * @type {Array} + * @type {Array|null} */ this.layers_ = options.layers ? options.layers : null; } /** - * @return {Array} layers + * @return {Array|null} layers */ getLayers() { return this.layers_; } /** - * @param {Array} layers Layers to parse. + * @param {Array|null} layers Layers to parse. */ setLayers(layers) { this.layers_ = layers; diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index 2a318c0b64..30e68fe30d 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -168,7 +168,7 @@ class DragAndDrop extends Interaction { /** * @private - * @type {HTMLElement} + * @type {HTMLElement|null} */ this.target = options.target ? options.target : null; } diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index 64c7be6c98..21054f8b82 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -257,14 +257,14 @@ class Draw extends PointerInteraction { /** * Target source for drawn features. - * @type {VectorSource} + * @type {VectorSource|null} * @private */ this.source_ = options.source ? options.source : null; /** * Target collection for drawn features. - * @type {import("../Collection.js").default} + * @type {import("../Collection.js").default|null} * @private */ this.features_ = options.features ? options.features : null; @@ -1022,7 +1022,7 @@ class Draw extends PointerInteraction { /** * Stop drawing without adding the sketch feature to the target layer. - * @return {Feature} The sketch feature (or null if none). + * @return {Feature|null} The sketch feature (or null if none). * @private */ abortDrawing_() { diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index 91d4da84b9..613a3aac80 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -115,7 +115,7 @@ class Snap extends PointerInteraction { super(pointerOptions); /** - * @type {import("../source/Vector.js").default} + * @type {import("../source/Vector.js").default|null} * @private */ this.source_ = options.source ? options.source : null; @@ -133,7 +133,7 @@ class Snap extends PointerInteraction { this.edge_ = options.edge !== undefined ? options.edge : true; /** - * @type {import("../Collection.js").default} + * @type {import("../Collection.js").default|null} * @private */ this.features_ = options.features ? options.features : null; diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index b5d54cd61e..8d0d9326f3 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -169,7 +169,7 @@ class Translate extends PointerInteraction { this.startCoordinate_ = null; /** - * @type {Collection} + * @type {Collection|null} * @private */ this.features_ = options.features !== undefined ? options.features : null; diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index 6141cd84d0..b99f5dd28d 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -119,7 +119,7 @@ class BaseLayer extends BaseObject { * @private */ this.className_ = - properties.className !== undefined ? options.className : 'ol-layer'; + properties.className !== undefined ? properties.className : 'ol-layer'; delete properties.className; this.setProperties(properties); @@ -288,7 +288,7 @@ class BaseLayer extends BaseObject { } /** - * Sets the backgrlound color. + * Sets the background color. * @param {BackgroundColor} [opt_background] Background color. */ setBackground(opt_background) { diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index 914f0ab77b..7253aca49d 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -127,7 +127,7 @@ class ImageSource extends Source { /** * @private - * @type {Array} + * @type {Array|null} */ this.resolutions_ = options.resolutions !== undefined ? options.resolutions : null; @@ -146,7 +146,7 @@ class ImageSource extends Source { } /** - * @return {Array} Resolutions. + * @return {Array|null} Resolutions. */ getResolutions() { return this.resolutions_; diff --git a/src/ol/source/ImageStatic.js b/src/ol/source/ImageStatic.js index 95c30c808f..de7ae14f1e 100644 --- a/src/ol/source/ImageStatic.js +++ b/src/ol/source/ImageStatic.js @@ -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; diff --git a/src/ol/source/Source.js b/src/ol/source/Source.js index 1642417d74..1e41d81f0e 100644 --- a/src/ol/source/Source.js +++ b/src/ol/source/Source.js @@ -150,7 +150,7 @@ class Source extends BaseObject { /** * @abstract - * @return {Array|undefined} Resolutions. + * @return {Array|null} Resolutions. */ getResolutions() { return abstract(); diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index d172824399..b09e812d4c 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -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} Resolutions. + * @return {Array|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() { diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index 77f4f61bd8..e9ff757885 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -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} The feature (or `null` if not found). + * @return {import("../Feature.js").default|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} The feature (or `null` if not found). + * @return {import("../Feature.js").default|null} The feature (or `null` if not found). */ getFeatureByUid(uid) { const feature = this.uidIndex_[uid]; diff --git a/src/ol/source/VectorTile.js b/src/ol/source/VectorTile.js index 4351345dd9..61036abdea 100644 --- a/src/ol/source/VectorTile.js +++ b/src/ol/source/VectorTile.js @@ -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; diff --git a/src/ol/style/Fill.js b/src/ol/style/Fill.js index cb96102514..092cb237bc 100644 --- a/src/ol/style/Fill.js +++ b/src/ol/style/Fill.js @@ -4,7 +4,7 @@ /** * @typedef {Object} Options - * @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color=null] A color, gradient or pattern. + * @property {import("../color.js").Color|import("../colorlike.js").ColorLike|null} [color=null] A color, gradient or pattern. * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats. * Default null; if null, the Canvas/renderer default black will be used. */ @@ -23,7 +23,7 @@ class Fill { /** * @private - * @type {import("../color.js").Color|import("../colorlike.js").ColorLike} + * @type {import("../color.js").Color|import("../colorlike.js").ColorLike|null} */ this.color_ = options.color !== undefined ? options.color : null; } @@ -42,7 +42,7 @@ class Fill { /** * Get the fill color. - * @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color. + * @return {import("../color.js").Color|import("../colorlike.js").ColorLike|null} Color. * @api */ getColor() { @@ -52,7 +52,7 @@ class Fill { /** * Set the color. * - * @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color. + * @param {import("../color.js").Color|import("../colorlike.js").ColorLike|null} color Color. * @api */ setColor(color) { diff --git a/src/ol/style/Style.js b/src/ol/style/Style.js index 4e2bb3bf7d..516a4b3bbf 100644 --- a/src/ol/style/Style.js +++ b/src/ol/style/Style.js @@ -455,7 +455,7 @@ export function toFunction(obj) { } /** - * @type {Array