7 New Features From Microsoft’s TypeScript 3.7

TypeScript is an open-source programming language developed by Microsoft and has been gaining popularity in an exponential way in the developers’ world. This language adds static type-checking along with type syntax which helps in detecting the problems with the code before running it by reporting errors if something questionable is done. 

The updated version, Typescript 3.7 was released on 5 November 2019 which includes various intuitive features. In the previous versions, this language had features which included features like:

  • Completions
  • Quick fixes
  • Refactorings for both TypeScript and JavaScript

This time, the updated version not only includes one of the highly-demanded ECMAScript features, optional chaining and nullish coalescing but many other intuitive features.


Sign up for your weekly dose of what's up in emerging technology.

The features included in version TypeScript 3.7 are mentioned below

  • Optional Chaining

As mentioned, Optional Chaining is one of the most highly-demanded ECMAScript features in TypeScript. The issue of optional chaining is not new and according to the developer community, the issue has been filed 5 years ago. This feature is mainly used for syntax and messaging purposes where it allows the developers to write codes where they can immediately stop running some expressions if they run into a null or undefined. 

Besides the new ?. operator for optional property accesses, optional chaining also includes two other operations which are the optional element access which acts similarly to optional property accesses but allows the developers to access non-identifier properties. The second operation is the optional call which allows us to conditionally call expressions if they’re not null or undefined.   

  • Nullish Coalescing

Nullish Coalescing is another ECMAScript feature which goes hand-in-hand with optional chaining. For this feature, the ?? operator works as a way to fall back to a default value when dealing with null or undefined. 

  • Assertion Functions

The assertion functions are a specific set of functions which throw an error if something happens unexpectedly. TypeScript 3.7 introduces a new concept called “assertion signatures” which model the assertion functions. It ensures that whatever condition is being checked must be true for the remainder of the containing scope.

  • Better Support For Never-Returning Functions

This feature is related as a part of assertion signatures. It ensures that a function never potentially returned undefined or effectively returned from all code paths. If it happens and never-returning functions are called, TypeScript recognises that the control flow graph has been affected and thus accounts for it. 

  • –declaration and –allowJs

The –declaration flag in TypeScript allows the developers to generate .d.ts files (declaration files) from TypeScript source files. This feature is important for a number of reasons such as it allow TypeScript to type-check against other projects without re-checking the original source code, it also allows TypeScript to interoperate with the existing JavaScript libraries which were not built with TypeScript in mind. With the help of this feature, a user can also write libraries in JSDoc annotated JavaScript and support TypeScript users.

  • (More) Recursive Type Aliases

Type aliases have always had a limitation in how they could be “recursively” referenced. TypeScript 3.7 mitigates this issue by resolving type arguments at the top level of a type alias.

  • The useDefineForClassFields Flag and The declare Property Modifier

TypeScript 3.7 provides a new flag called useDefineForClassFields to enable a logically enhanced emit mode. In this case, the declarations will be initialised with Object.defineProperty and they will always be initialised to undefined, even if they have no initialiser.

The other features included in TypeScript 3.7 are Build-Free Editing with Project References, Uncalled Function Checks, Flatter Error Reporting, // @ts-nocheck in TypeScript Files, Semicolon Formatter Option, Website and Playground Updates and Breaking Changes.

TypeScript Playground

For those who have not tried their hands on TypeScript, Playground is exclusively made for them. TypeScript 3.7 has updated it and one can test out the programming language in TypeScript Playground. 

More Great AIM Stories

Ambika Choudhury
A Technical Journalist who loves writing about Machine Learning and Artificial Intelligence. A lover of music, writing and learning something out of the box.

Our Upcoming Events

Conference, in-person (Bangalore)
Machine Learning Developers Summit (MLDS) 2023
19-20th Jan, 2023

Conference, in-person (Bangalore)
Rising 2023 | Women in Tech Conference
16-17th Mar, 2023

Conference, in-person (Bangalore)
Data Engineering Summit (DES) 2023
27-28th Apr, 2023

Conference, in-person (Bangalore)
MachineCon 2023
23rd Jun, 2023

Conference, in-person (Bangalore)
Cypher 2023
20-22nd Sep, 2023

3 Ways to Join our Community

Whatsapp group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our newsletter

Get the latest updates from AIM