
Today I made some important improvements to my we-assert package: https://github.com/xerocross/we-assert. For one thing, I translated it into TypeScript. Also, I have already come to really like using it myself. I doubt there is anything unique or interesting about it enough to draw attention to it from the community, but I like that it offers a literate way to put error-checking assertions in your code and handle them exactly the way you want. In many ways the statements are modeled after typical language constructs used for testing suites to be run by Jest or the like. The difference is that We-Assert statements are executed at runtime.
Do you want the extra computation time associated with running tests and checks on code at runtime, when the user is actually using your code? It depends. Some things simply must be 100% correct, or really, really damn close to it. Whatever software banks use to manage money transactions, for example—that is something I’d want to be as close to perfectly correct always as possible.
I have been using We-Assert extensively in my own other project, xerocross.fu. That one is about functional programming in JavaScript (or trying to). But it’s also about writing code that is as perfectly proven to be absolutely correct as I can manage to do. It’s correct or it throws. That’s what I’m going for with xerocross.fu.
I’m having fun with both projects.