Fix proj4 type

Previous typing was confusing the compiler. It could not figure out the
difference between the proj4 property and the constructor, which lead to
errors such as:

- ol.proj.setProj4(proj4)
ERR! compile /home/gberaudo/dev/ngeo/src/proj/epsg21781.js:8: ERROR - actual parameter 1 of ol.proj.setProj4 does not match formal parameter
ERR! compile found   : function (new:proj4): ?
ERR! compile required: (null|proj4)
ERR! compile   ol.proj.setProj4(proj4);
ERR! compile                    ^^^^^

- ol.proj.proj4.get().defs('EPSG:21781', epsg21781def)
ERR! compile /home/gberaudo/dev/ngeo/src/proj/epsg21781.js:26: ERROR - Property defs never defined on proj4
ERR! compile   ol.proj.proj4.get().defs('EPSG:21781', epsg21781def);
ERR! compile                       ^^^^
This commit is contained in:
Guillaume Beraudo
2017-03-22 09:45:10 +01:00
parent f4bf92a488
commit 630d9c5200
3 changed files with 18 additions and 12 deletions

View File

@@ -7,25 +7,31 @@
/**
* @constructor
*/
var proj4 = function() {};
var Proj4 = function() {};
/**
* @type {function(Array.<number>): Array.<number>}
* @param {ol.Coordinate} coordinates
* @return {ol.Coordinate}
*/
proj4.prototype.forward;
Proj4.prototype.forward = function(coordinates) {};
/**
* @type {function(Array.<number>): Array.<number>}
* @param {ol.Coordinate} coordinates
* @return {ol.Coordinate}
*/
proj4.prototype.inverse;
Proj4.prototype.inverse = function(coordinates) {};
/**
* @param {string} name
* @param {(string|Object)=} opt_def
* @return {undefined|Object.<string, Object.<{axis: string, units: string,
* to_meter: number}>>}
* @return {undefined|Object.<string, Object.<{axis: string, units: string, to_meter: number}>>}
*/
proj4.defs = function(name, opt_def) {};
Proj4.prototype.defs = function(name, opt_def) {};
/**
* @type {Proj4}
*/
var proj4;