TeJaS: A Family of Type-Checkers for JavaScript

Programmers use type systems to prevent errors in their programs, but precisely which behaviors should be considered erroneous varies from programmer to programmer. Indeed, the flexibility of JavaScript makes it essentially futile to design a single type system that is flexible enough for all purposes; instead, we need multiple, related type systems that can be customized for each programmer.

Flexible Implementations of Type Systems

Our implementation takes advantage of OCaml's functor system, and provides a Base type system module with typical types and typing rules, and hooks for an Extension module to extend the Base with new types and typing rules.

The TeJaS system is summarized in our paper at DLS 2013.

Applications

We've used TeJaS to implement a type system for jQuery, which augments the Base system with new kinds for describing the sizes of jQuery collection objects.

Code

TeJaS is open-source and available on Github.