Remove unnecessary typecast

Remove typecast where typescript is able to correctly deduce the type.
This commit is contained in:
Frederic Junod
2019-10-02 10:44:05 +02:00
parent fa0258a323
commit daaaff5ac7
5 changed files with 6 additions and 11 deletions

View File

@@ -539,8 +539,7 @@ class PluggableMap extends BaseObject {
return;
}
const coordinate = this.getCoordinateFromPixelInternal(pixel);
opt_options = opt_options !== undefined ? opt_options :
/** @type {AtPixelOptions} */ ({});
opt_options = opt_options !== undefined ? opt_options : {};
const hitTolerance = opt_options.hitTolerance !== undefined ?
opt_options.hitTolerance * this.frameState_.pixelRatio : 0;
const layerFilter = opt_options.layerFilter !== undefined ?
@@ -592,7 +591,7 @@ class PluggableMap extends BaseObject {
if (!this.frameState_) {
return;
}
const options = opt_options || /** @type {AtPixelOptions} */ ({});
const options = opt_options || {};
const hitTolerance = options.hitTolerance !== undefined ?
options.hitTolerance * this.frameState_.pixelRatio : 0;
const layerFilter = options.layerFilter || TRUE;
@@ -612,8 +611,7 @@ class PluggableMap extends BaseObject {
return false;
}
const coordinate = this.getCoordinateFromPixelInternal(pixel);
opt_options = opt_options !== undefined ? opt_options :
/** @type {AtPixelOptions} */ ({});
opt_options = opt_options !== undefined ? opt_options : {};
const layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE;
const hitTolerance = opt_options.hitTolerance !== undefined ?
opt_options.hitTolerance * this.frameState_.pixelRatio : 0;

View File

@@ -126,7 +126,7 @@ class ScaleLine extends Control {
this.addEventListener(getChangeEventType(UNITS_PROP), this.handleUnitsChanged_);
this.setUnits(/** @type {Units} */ (options.units) || Units.METRIC);
this.setUnits(options.units || Units.METRIC);
/**
* @private

View File

@@ -70,7 +70,7 @@ export function toSize(size, opt_size) {
if (opt_size === undefined) {
opt_size = [size, size];
} else {
opt_size[0] = opt_size[1] = /** @type {number} */ (size);
opt_size[0] = opt_size[1] = size;
}
return opt_size;
}

View File

@@ -98,8 +98,7 @@ class RegularShape extends ImageStyle {
* @protected
* @type {number}
*/
this.radius_ = /** @type {number} */ (options.radius !== undefined ?
options.radius : options.radius1);
this.radius_ = options.radius !== undefined ? options.radius : options.radius1;
/**
* @private

View File

@@ -88,12 +88,10 @@ export function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) {
* @api
*/
export function createXYZ(opt_options) {
/** @type {XYZOptions} */
const xyzOptions = opt_options || {};
const extent = xyzOptions.extent || getProjection('EPSG:3857').getExtent();
/** @type {import("./tilegrid/TileGrid.js").Options} */
const gridOptions = {
extent: extent,
minZoom: xyzOptions.minZoom,