View on GitHub


It’s common for even the best programmers to make simple mistakes. And sometimes a refactoring which seems safe can leave behind code which will never do what’s intended.

The TypeScript compiler helps prevent a lot of the mistakes you might make when writing JavaScript code. However, the set of checks it performs are limited. You can augment the static analysis of the compiler by adding linting rules, but many toolchains only run the linter when the code is ready for review or submit. We want to catch correctness issues in the same way the compiler catches type errors.

You can think of the TypeScript compiler as a linter for the Language Spec. Tsetse is essentially an extension to that spec, adding new patterns which are disallowed in TypeScript programs. The tsetse library lets us plug new third-party checks into the standard compiler.

Tsetse …

Currently, Tsetse is built into the Bazel TypeScript compiler. However we hope that it will be possible to plug into the standard tsc compiler later.

Tsetse is modelled on the Error Prone project for Java.


const s = " Hello, world! ";
$ bazel build :all
mycode.ts(2,1): error TS21222: return value is unused.