Under-the-hood of type systems (e.g. TypeScript)

I struggled to find an explanation from a low-level view of exactly how a “JavaScript type system compiler” is implemented. I understood many of the jobs of a type system but was unsure of the mechanisms involved and how they worked together.

This article will aim to shine a light on some of the fundamentals at work under-the-hood. It is not possible to focus on everything in 1 article so here we will be looking at “type checks” specifically. Starting with an overview of type systems then building our own compiler which can run type checks and…