I cannot get to properly type the following piece of code:
/**
* @constructor
*/
function F() {
this.a = 0;
};
/**
* @type {function(number)}
*/
F.prototype.g = function(b) {
this.a += b;
};
I get the following warning:
test.js:12: WARNING - could not determine the type of this expression
this.a += b;
^
How can I properly type this
in this example?
-- EDIT --
If you want to see the warning, you need to set reportUnknownTypes
to true
as explained here. I am trying to get to 100% typed code and I figured I could not reach that for that simple a program.