Concrete Types for TypeScript

TypeScript extends JavaScript with optional type annotations that are unsound by design and discarded by the TypeScript compiler as it emits code. This design point preserves programming idioms developers are familiar with, and allows them to leave their legacy code unchanged, while offering a measure of static error checking in parts of the program that have type annotations.

We present an alternative design for TypeScript: one where it is possible to support the same degree of dynamism, but where types can be strengthened to provide hard guarantees. We report on an implementation, called StrongScript, that improves runtime performance of typed programs when run on a modified version of the V8 JavaScript engine.


The compiler distribution includes the examples discussed in the paper. The modified V8 engine is not yet released.


Paper History

This work started as an attempt to clean up the Like Types system described in our POPL paper and prove the trace preservation and strengthening theorems. When TypeScript came along we noticed the similarities with Thorn and decided to see if an implementation of Like Types would work in that context. For perfomance, we implemented a number of optimization in the Oracle Truffle virtual machine.

The paper was first submitted to PLDI and then to POPL. The main difference between the two is that we made Like Types be the default and added a ! in front of concrete types. The ECOOP submitted version changed the exposition to better explain our contribution.

The final ECOOP version ditched Truffle because it proved unstable when installed in a VMWare image and replaced it with a V8 implementation. A number of typos were fixed. And an explanation of the casts inserted by the compiler which confused many readers and some of the authors.

Last update: