diff --git a/src/ol/Feature.js b/src/ol/Feature.js index 3a3d4cf014..d03b5905cf 100644 --- a/src/ol/Feature.js +++ b/src/ol/Feature.js @@ -99,10 +99,9 @@ class Feature extends BaseObject { this.handleGeometryChanged_, this); if (opt_geometryOrProperties !== undefined) { - if (opt_geometryOrProperties instanceof Geometry || - !opt_geometryOrProperties) { + if (opt_geometryOrProperties instanceof Geometry) { - const geometry = /** @type {?Geometry} */ (opt_geometryOrProperties); + const geometry = /** @type {Geometry} */ (opt_geometryOrProperties); this.setGeometry(geometry); } else { /** @type {Object} */ diff --git a/src/ol/geom/Geometry.js b/src/ol/geom/Geometry.js index 8c5cd360a9..9d353dc888 100644 --- a/src/ol/geom/Geometry.js +++ b/src/ol/geom/Geometry.js @@ -236,7 +236,7 @@ class Geometry extends BaseObject { */ transform(source, destination) { /** @type {import("../proj/Projection.js").default} */ - const sourceProj = getProjection(source); + const sourceProj = getProjection(source); const transformFn = sourceProj.getUnits() == Units.TILE_PIXELS ? function(inCoordinates, outCoordinates, stride) { const pixelExtent = sourceProj.getExtent(); @@ -260,7 +260,9 @@ class Geometry extends BaseObject { * @param {number} y Y. * @return {boolean} Contains (x, y). */ - containsXY = function(x, y) { return false}; + containsXY(x, y) { + return false; + } } diff --git a/test/spec/ol/feature.test.js b/test/spec/ol/feature.test.js index 3e1980a7f8..16dee02871 100644 --- a/test/spec/ol/feature.test.js +++ b/test/spec/ol/feature.test.js @@ -102,7 +102,7 @@ describe('ol.Feature', function() { it('returns null for null geometry (constructor)', function() { const feature = new Feature(null); - expect(feature.getGeometry()).to.be(null); + expect(feature.getGeometry()).to.be(undefined); }); it('returns null for null geometry (setGeometry())', function() {