This is a document defect. I don't think tap() equals to the following codes:
// Using only .then()
promise.then(function(x) {
doSideEffectsHere(x);
return x;
});
Actually, based on my understanding, it equals to :
promise.then(function(x) {
when(doSideEffectsHere(x)).then(function(){x;});
});