TypeScript's 3.6 release is out: New features for Microsoft's JavaScript programming language spin-off

TypeScript 3.6 introduces a range of usability improvements, which should make it easier for developers to spot errors and give them greater control.

The worst programming languages to learn in 2019 Codementor lists the struggling languages that may not be worth your time.

The latest release of Microsoft's popular JavaScript spin-off TypeScript is now available.

TypeScript 3.6 introduces a range of usability improvements, which should make it easier for developers to spot errors and give them greater control.

For those unaware, TypeScript is a superset of JavaScript developed by Microsoft, which adds optional type checking and other features that make it easier to write large and complex code bases using JavaScript.

In recent years, the popularity of TypeScript has risen sharply, and today is used by major companies such as Slack and Microsoft.

Being built on top of JavaScript, TypeScript has many similarities to the base language and can be compiled to vanilla JavaScript, making it relatively easy to switch from using JavaScript to TypeScript.

One of the biggest improvements in TypeScript 3.6 is a change to generators to give developers more control over how they are used.

TypeScript generators can relay data via the return or yield keywords, and in 3.6 developers can now determine whether data was returned or yielded.

The addition of strict checking for iterators and generators means the TypeScript checker also knows the data type of values that are returned or yielded.

SEE: How to build a successful developer career (free PDF) (TechRepublic)  

Additionally, TypeScript now knows the type of data can be passed to a generator using the next() method and will throw an error if a developer mismatches the type, for example assigning an integer to a variable declared as a string.

In other changes, when using the … spread operator, for example to pass a single array of variables to a function that expects multiple arguments, TypeScript gives developers more control to eliminate unexpected behavior.

TypeScript 3.6 also simplifies the process of using Promises, commonly used when handling asynchronous data, for example when code has to wait for an unknown period for data to be returned from an online API.

Error messages returned by Promises now remind the developer of the need to wait for the contents of a Promise to be returned, using .then() or await.

Supported editors, such as Visual Studio or Visual Studio Code, can now also highlight and add missing await keywords in code. Support for TypeScript 3.6 is available in Visual Studio, Visual Studio Code and Sublime Text 3, with other editors expected to gain support in the near future. 

You can read about the other changes in TypeScript 3.6 here. Upgrading to TypeScript 3.6 can be carried out via npm and the command npm install -g typescript or through Nuget.

The next major release of TypeScript is expected to add the long-awaited optional chaining feature, which makes it easier to write code that interrogates nested data and that can handle unexpected changes in the data structure. 

You can read which other features are on the horizon by checking out the language's six-month roadmap.

For those who want to experiment with TypeScript with minimal hassle, the online TypeScript Playground has also been refreshed.

If you're interested in finding out more about TypeScript, check out TechRepublic's round-up of the best free resources for learning the language online.

Also see 

Programmer working with program code

Image: iStockphoto/RossHelen