Feature.clone returns correct type.

This commit is contained in:
Simon Seyock
2021-08-06 10:05:19 +02:00
parent 4f38dd2c66
commit cebaa546b7

View File

@@ -144,17 +144,17 @@ class Feature extends BaseObject {
/**
* Clone this feature. If the original feature has a geometry it
* is also cloned. The feature id is not set in the clone.
* @return {Feature} The clone.
* @return {Feature<Geometry>} The clone.
* @api
*/
clone() {
const clone = new Feature(
this.hasProperties() ? this.getProperties() : null
const clone = /** @type {Feature<Geometry>} */ (
new Feature(this.hasProperties() ? this.getProperties() : null)
);
clone.setGeometryName(this.getGeometryName());
const geometry = this.getGeometry();
if (geometry) {
clone.setGeometry(geometry.clone());
clone.setGeometry(/** @type {Geometry} */ (geometry.clone()));
}
const style = this.getStyle();
if (style) {