Testing static types in TypeScript

1 · Axel Rauschmayer · July 11, 2019, 10:22 a.m.
In this blog post, we’ll examine how we can test static types in TypeScript (inferred types, etc.). For example, given the following function: function createPoint(x: number, y: number) { return {x, y}; } We’d like to check in a unit test that TypeScript infers this return type: {x: number, y: number} In order to do that, we need a few tools that we are going to look at first. [Read rest of post]...