Continuation-Passing Style in TypeScript

Continuation-passing style (CPS) is an occasionally very useful technique which is fairly niche for developers outside of functional programming languages. Many JavaScript developers are familiar with a similar technique in which callbacks are used to handle asynchronous operations in pre-promise-era node.js code, but CPS itself is more general. This post will introduce CPS and show how it can…