Introduction
A type test runner for TypeScript.
Why TSTyche?
TSTyche exists because developers deserve a feature-rich and robust test runner for their types.
Take a look at any popular JavaScript test runner. It is a command line tool. It has test() and describe() helpers with .only and .skip modifiers. It is able to select test files using a pattern or to run a specific test file. And it reports success in green and failures in red.
TSTyche brings that experience to types.
How TSTyche Works
TSTyche uses TypeScript’s API to query type information, but it goes beyond type checking. Its expect style matchers assert, for example, that two types are identical or that a function is not callable with given arguments. TSTyche can even verify the messages of errors suppressed by @ts-expect-error directives.
By default, TSTyche loads the typescript package installed in your project. Otherwise, it fetches the latest version. You can also select specific TypeScript versions to test against, and TSTyche will fetch them as needed.
Goals of the Project
TSTyche is built for projects of any size — from a small utility library to a large monorepo. It aims to be:
- lightweight
- performant
- predictable
- scalable
The Name
The name of TSTyche is abbreviated from TypeScript type check. In the early stages of development the library was conceived as a type checker. Later it became a type test runner, but the name remained.
In Greek mythology, Tyche was the goddess of fortune and prosperity.