Another option would be to annotate the methods return type properly, so that PhpStorm knows that the function is expected to return undefined
in some cases.
/**
* @param {number} [newX]
* @returns {number|undefined}
*/
this.x = function(newX) {
// ...
}