5 Things I Love About The TypeScript 4.0 Release

5 Things I Love About The TypeScript 4.0 Release

Diving into 5 awesome features/ improvements of the new TypeScript Release. Recently, TypeScript released the latest version of the language: V4.0. It comes with several features and enhancements available across the language itself and the tooling. So far, what it offers is quite promising. In this article, I am going to present five things that I love, comes with this release.

Recently, TypeScript released the latest version of the language: V4.0. It comes with several features and enhancements available across the language itself and the tooling. So far, what it offers is quite promising. In this article, I am going to present five things that I love, comes with this release.

1. Editor improvements

As developers, we spend most of our time working with a code editor. I am a heavy VS Code user at the moment. Therefore I will start with the VS Code editor improvements for TS4. To use the latest editor functionalities, you have to switch the TS version in VS Code to the latest. Open command pallet and find the command TypeScript: Select Version and pick the newest version.

Image for post

Changing TS version in VS Code

Refactoring Hint to Convert to Optional Chaining

When working with nested objects, one of the most painful mistakes is to fail to check for undefined or null when accessing an object property. Let's consider the following example:

// Approach 1
// This will break if the user is undefined or address
if(user.address.city){ }
// Approach 2
// Can be solved
if(user && user.address && user.address.city){ }
// Approach 3
// With optional chaining
if(user?.address?.city){ }

With TS4, it automatically suggests converting to optional chaining whenever it is applicable. I have been using Approach 2 for the most part, and that is how I used to start writing the code if it is accessing any inner object properties. Since converting to optional chaining is hinted, it is straightforward for me to write much readable code.

Image for post

Image for post

Convert to Optional Chaining hint in VS Code

Support for deprecated JSDoc comments

When it comes to using 3rd party libraries or modules, it is hard to notice if a Class or a Method has been deprecated unless we refer the documentation. With the new release, now it shows the syntax with a strikethrough text. Therefore it is easy to see which parts of your code use deprecated syntax.

new-releases typescript javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

What is TypeScript? Why TypeScript? and Why Not TypeScript?

TypeScript extends JavaScript by adding Types. There are many great reasons to switch to TypeScript. Especially if your team uses JavaScript. There are some reasons to not use TypeScript as there are with any language or framework.

Meet Deno: The New JavaScript/TypeScript Runtime

Deno 1.0 was released on May 13, 2020. Deno is Ryan Dahl’s (yeah, you guessed it right, the guy who created Node.js) latest venture. But it isn’t just another JavaScript Engine. It also supports TypeScript — JavaScript’s strictly typed cousin — out of the box.

What's new in TypeScript 4.0? — Release Review

We'll go over the newest features available in TypeScript 4.0: Tuple Type Enhancements; Class Property Type Inference (via Constructors); New Assignment Operators; `unknown` on `catch`; JSX Factory Customization; `--incremental` Build Improvements; Editor Support Improvements; Breaking Changes; How to Install

What’s New in TypeScript 3.9

TypeScript just released its second release for the year on May 12. It’s version 3.9, which is now the stable version. In this article, I’m going to point out some of the new and exciting features of TypeScript 3.9. An overview of everything that just went live. In this post, we'll see What’s New in TypeScript 3.9?

TypeScript Tutorial For JavaScript Developers - TypeScript Basics

TypeScript Tutorial For JavaScript Developers - TypeScript Basics. I will show you guys 4 example of JavaScript code, and how to convert it to TypeScript. This is a typescript beginners tutorial.