I came across a tutorial version of the famous Box2D physics engine written in C++ back in 2006. As it is a tutorial code, it is (relatively) short but has features well beyond the typical freely available tutorial. I set about porting it to JS/Phaser by extending the Geom.Rectangle class.
Please don’t say “just use Matter.js!” This is simply for fun and education!
Extending Geom.Rectangle to Box2D-Lite, Warm Starting (codepen.io)
(After completing my port, I found that Richard Davey himself has already ported the same into TypeScript - however his version is a “souped up” version with a quad-tree added for extra measure)