TypeScript 5.0: New & Breaking changes.

Rakesh Purohit
Published in
3 min readMar 9, 2023
Our graphic designer is back from vacation.

I am writing an article after a bit longer than I expected. So, let’s jump in [..my Lamborghini Gallardo]. (Okay, no singing eminem)

The superset of JavaScript is going for a major release. At some point, I am happy and at some point, I am more than happy. Why? Let’s find out.

Just for a good start.

Improved Type Inference

Improved type inference features in TypeScript 5.0 help to reduce the amount of code that developers must write. TypeScript can now infer the return types of methods that employ the return keyword, as well as the types of object literals provided to variables, thanks to this functionality. This simplifies the development process and allows developers to concentrate on creating code rather than defining types.

In prior versions of TypeScript, for example, developers had to explicitly define the return type of a method, even if it could be deduced from the code. TypeScript 5.0 allows developers to remove the return type, and TypeScript will infer it depending on the code.

Because I use ProCode developer tool called DhiWise

Smarter Type Aliases

TypeScript 5.0 offers smarter type aliases, which enable developers to design more complicated types with less code. Developers can utilize this capability to construct new kinds from existing ones, making it easier to define complicated data structures.

Type aliases allow you to give an existing type a new name. They can be used to simplify complex types or to improve readability. Instead of writing out a complex type several times, a developer can construct a type alias for it and utilize it instead.

Me watching other React developers struggle for CSS because I’ve got DhiWise

Improved Error Messages

Improved error messages in TypeScript 5.0 make it easier for developers to discover and correct mistakes in their code. The new error messages contain more context and information, allowing developers to rapidly identify the source of the mistake and take corrective action.

If a developer, for example, forgets to create a variable before using it, TypeScript 5.0 will provide a more descriptive error message that includes the line number and file name where the error occurred. This makes it easy for developers to identify and correct errors.

No caption for this. Just a tribute to one of the great representatives

One more thing

There are numerous deprecations, code snippets for the above-mentioned features, and many other features such as:

  1. Decorators
  2. All enums are union enums
  3. const type parameter
  4. @satisfies & @overload support for JSDoc
  5. and much more you can read here

Deprecation: A major change

The major deprecation, in my point of view is ES3 as the default target. This doesn’t mean it is completely gone. It will still exist with some tweaks officially supported by TypeScript.

But I guess sooner or later we must be ready with it.

Me after generating React + TypeScript app in DhiWise from Figma


These are just a few of the new features and enhancements included in TypeScript 5.0 beta. TypeScript 5.0 offers, in addition to the features stated above, enhancements to the build process, increased support for decorators, and much more.

Whether you’re a seasoned developer or just starting out, the latest version of TypeScript promises to improve the efficiency and enjoyment of your programming experience. So why not give it a shot and see what you think?

TypeScript 5.0 is sure to make your development process smoother and more streamlined with its better type inference, smarter type aliases, improved error messages, and class property inference from constructors.

We have a developer community thriving with knowledge and awesomeness! We had a webinar on TypeScript that you can watch here if you missed it:

A little about myself:

I am Rakesh Purohit, an SDE-3 (React) & DevRel at DhiWise.

DhiWise lets you build React and Flutter Apps at blazing fast speed without compromising on code-quality and developer-experience. Check out the platform to know more.

Find me on Twitter, LinkedIn, and GitHub.