# The 5 Big Features of TypeScript 3.7 and How to Use Them

DevFeed: [The 5 Big Features of TypeScript 3.7 and How to Use Them](<https://devfeed.tech/articles/the-5-big-features-of-typescript-3-7-and-how-to-use-them-19035.md>)

Original publisher: [Read original article](<https://httptoolkit.com/blog/5-big-features-of-typescript-3.7/>)

Author: HTTP Toolkit; Tim Perry

Published: 2019-09-12T12:00:00Z

Content type: tutorial

Language: en

Sources: [HTTP Toolkit](<https://devfeed.tech/sources/http-toolkit.md>)

Topics: [TypeScript](<https://devfeed.tech/topics/typescript.md>), [Development](<https://devfeed.tech/topics/development.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>)

Tags: [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

## AI overview

An overview of five planned TypeScript 3.7 features: assert signatures, recursive type aliases, top-level await, null coalescing, and optional chaining. It explains how assert signatures can act as type guards and notes that their final details were still in flux.

## Source excerpt

The TypeScript 3.7 release is coming soon, and it's going to be a big one. The target release date is November 5th, and there's some seriously exciting headline features included: Assert signatures Recursive type aliases Top-level await Null coalescing Optional chaining Personally, I'm super excited about this, they're going to whisk away all sorts of annoyances that I've been fighting in TypeScript whilst building HTTP Toolkit. If you haven't been paying close attention to the TypeScript development process though, it's probably not clear what half of these mean, or why you should care. Let's talk them through. Assert Signatures This is a brand-new & little-known TypeScript feature, which allows you to write functions that act like type guards as a side-effect, rather than explicitly returning their boolean result. It's easiest to demonstrate this with a JavaScript example: // In JS: function assertString(input) { if (typeof input === 'string') return; else throw new Error('Input must be a string!'); } function doSomething(input) { assertString(input); // ... Use input, confident that it's a string } doSomething('abc'); // All good doSomething(123); // Throws an error This pattern is neat and useful and you can't use it in TypeScript today. TypeScript can't know that you've guaranteed the type of input after it's run assertString. Typically people just make the argument input: string to avoid this, and that's good, but that also just pushes the type checking problem somewhere else, and in cases where you just want to fail hard it's useful to have this option available. Fortunately, soon we will: // With TS 3.7 function assertString(input: any): asserts input is string { // <-- the magic if (typeof input === 'string') return; else throw new Error('Input must be a string!'); } function doSomething(input: string | number) { assertString(input); // input's type is just 'string' here } Here assert input is string means that if this function ever returns, TypeScript can