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