DEV Community

Discussion on: Elegant patterns in modern JavaScript: RORO

Collapse
 
martinhaeusler profile image
Martin Häusler

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.