Guide
Introduction

Introduction

TSTyche is a type testing tool that was created to handle hundreds of type test in large monorepos. While that was the initial motivation, TSTyche is very easy to use with small projects too.

Goals of the Project

TSTyche is build to test projects of any size and complexity. It aims to be:

  • lightweight
  • performant
  • predictable
  • scalable

How It Works

To be able to test types TSTyche loads the typescript package installed in your project. It checks types programmatically and does not require any dependencies to be installed. This is why the install size of TSTyche is just above 200kB.

TSTyche wraps around TypeScript's language service API (opens in a new tab) that is designed to do the absolute minimum work required to answer a query. If only a single test file is selected for a run, there is no need to waste time to type check the whole program.

The language service API is also used by code editors like Visual Studio Code via the tsserver (opens in a new tab) executable. This means that TSTyche sees exactly the same types which you see in hover messages.

TSTyche ships with the test helpers to filter tests while debugging. Furthermore the tstyche command is able to select a test file or a TypeScript version or to run tests in the watch mode. These are just the right features you need while working at scale.

The Name

The name of TSTyche is abbreviated from TypeScript type check. In the early stage of development the library was defined as a type checker. Later it became a type test runner, but the name remained.

In Greek mythology, Tyche (opens in a new tab) was the goddess of fortune and prosperity.