re: Elegant patterns in modern JavaScript: RORO VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I think the biggest problem I have with using this approach as a matter of course is that, great, you have a simple signature and can return whatev...
 

These kinds of API usage issues can be avoided by using flow or TypeScript and a suitable editor. Code completion will tell you exactly what you can put into the options argument, and what to expect from the result. The actual downside in this approach lies elsewhere: constructing these additional "message" objects takes time. So I would not advice using this technique too excessively, especially in performance-critical regions of the code.

code of conduct - report abuse