Hi Alex,
Thanks for taking a close look at our transaction tutorial. I see there’s a bit of confusion between the community types and our actual functionality. Luckily the examples from the article are accurate as Lauren has clarified withTransaction returns a command result if the transaction was successful and returns nothing or undefined if the transaction was intentionally aborted.
I’ve created a ticket for us (NODE-3278) to clarify the return types and add some more descriptive notes to these transaction functions in our documentation.
Something to look forward to is our next major release, coming soon, is written in Typescript and we hope that it will offer high quality and accurate type information. It’s not yet production ready yet but you can check out the beta here if that is of interest.