Check out a free preview of the full TypeScript 3 Fundamentals, v2 course:
The "Type Tests" Lesson is part of the full, TypeScript 3 Fundamentals, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Mike introduces the dslint library, which allows for type test in TypeScript.

Get Unlimited Access Now

Transcript from the "Type Tests" Lesson

[00:00:00]
>> Mike North: I want to also show you this test here. So you can write tests for types. Microsoft has a library called dtslint, which uses tslint. And it basically parses the linting error messages and compares them against special comments that you can leave in your types. So, this isn't actually, I kind of lied when I said it was a Mocha test.

[00:00:28] This is just a TypeScript file with special comments in there. And this basically asserts that if there is an error, there must be an error here, I could just as easily say, $ExpectType,
>> Mike North: False, right? You can write test cases around things that are purely types. A lot of people don't realize this and they just skip tests completely when it comes to interfaces and things like that.

[00:00:59] But this can be a gnarly area of your code. Where if you have something that's a little bit abstract, you really wanna have some confidence around changes being nondestructive. So dtslint is what to look for.