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
+4 -4
View File
@@ -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) {
+1 -1
View File
@@ -455,7 +455,7 @@ export function toFunction(obj) {
}
/**
* @type {Array<Style>}
* @type {Array<Style>|null}
*/
let defaultStyles = null;
+4 -4
View File
@@ -168,7 +168,7 @@ class Text {
/**
* @private
* @type {Array<number>}
* @type {Array<number>|null}
*/
this.padding_ = options.padding === undefined ? null : options.padding;
}
@@ -201,7 +201,7 @@ class Text {
backgroundStroke: this.getBackgroundStroke()
? this.getBackgroundStroke().clone()
: undefined,
padding: this.getPadding(),
padding: this.getPadding() || undefined,
});
}
@@ -359,7 +359,7 @@ class Text {
/**
* Get the padding for the text.
* @return {Array<number>} Padding.
* @return {Array<number>|null} Padding.
* @api
*/
getPadding() {
@@ -530,7 +530,7 @@ class Text {
/**
* Set the padding (`[top, right, bottom, left]`).
*
* @param {!Array<number>} padding Padding.
* @param {Array<number>|null} padding Padding.
* @api
*/
setPadding(padding) {