From d10fb12f27f4757e442f3b4cc3e07af1fc18afeb Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 10 Nov 2013 02:21:13 +0100 Subject: [PATCH] Improve type checking with cast --- src/ol/geom/geometry.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ol/geom/geometry.js b/src/ol/geom/geometry.js index 2c371bef3e..d5943dd3f0 100644 --- a/src/ol/geom/geometry.js +++ b/src/ol/geom/geometry.js @@ -151,6 +151,7 @@ ol.geom.Geometry.prototype.getType = goog.abstractMethod; */ ol.geom.Geometry.prototype.setLayout = function(layout, coordinates, nesting) { + /** @type {number} */ var stride; if (goog.isDef(layout)) { if (layout == ol.geom.Layout.XY) { @@ -175,7 +176,7 @@ ol.geom.Geometry.prototype.setLayout = coordinates = coordinates[0]; } } - stride = coordinates.length; + stride = (/** @type {Array} */ (coordinates)).length; if (stride == 2) { layout = ol.geom.Layout.XY; } else if (stride == 3) {