/**
* @param {number} a - Left hand side value.
*/
function add(a) {
return (
/**
* @param {number} b Value.
* @returns {number} Sum of a and b.
*/
function (b) {
return a + b;
}
);
}
Output:
/**
* @param {number} a - Left hand side value.
*/
function add(a) {
if (!assertType(a, "number", 'add', 'a')) {
youCanAddABreakpointHere();
}
return (/**
* @param {number} b Value.
* @returns {number} Sum of a and b.
*/ function (b) {
return a + b;
});
}
The bug here is that the inner function lacks inserted type validations, even though we have the types present.
Example:
Output:
The bug here is that the inner function lacks inserted type validations, even though we have the types present.
To fix: