diff --git a/src/ol/Geolocation.js b/src/ol/Geolocation.js index f58127ddb3..2cac07da18 100644 --- a/src/ol/Geolocation.js +++ b/src/ol/Geolocation.js @@ -174,9 +174,12 @@ class Geolocation extends BaseObject { * @param {PositionError} error error object. */ positionError_(error) { - error.type = EventType.ERROR; + const event = { + type: EventType.ERROR, + target: undefined + }; this.setTracking(false); - this.dispatchEvent(/** @type {{type: string, target: undefined}} */ (error)); + this.dispatchEvent(event); } /**