Document the .tap vs .flatTap fire-and-forget footgun
Summary
Document the .tap vs .flatTap fire-and-forget footgun in the choosing-a-combinator guide (and possibly the tap/flatTap TSDoc).
The trap
Because a .tap callback's return is constrained by NotThenable, an effect that returns an AsyncResult (or Promise) cannot be threaded through .tap. If you call such an effect inside .tap, you must discard it in a statement block — and it silently becomes fire-and-forget:
.tap((value) => {
notifier.onEvent({ ... }); // returns AsyncResult<void, never> — floats, not awaited
})
vs. the await-and-thread form:
.flatTap(() => notifier.onEvent({ ... }))
In a real migration, two call sites of the same effect ended up split across the two forms (one used .tap, the other .flatTap). Both happened to be safe (the effect self-recovers its defects and returns AsyncResult<void, never>), but the asymmetry is easy to introduce by accident and hard to spot in review.
Proposal
- Add a short callout in
docs/guide/choosing-a-combinator.md: "running an effect that itself returns aResult/AsyncResult? useflatTap/flatTapErr, nottap— atapcallback can't return a thenable, so the effect will silently float." - Consider echoing one line of this in the
tapTSDoc pointing atflatTap.
Docs-only; no API change.