4 ms·How to build a program that cannot do the wrong thing3 points by Darmani 4y agodeleted 4y ago[deleted]designed 4y agoI would use a state machine in this case. The best tool for doing this in JavaScript/TypeScript is XState. Highly recommend.