The TypeScript team has rolled out TypeScript 5.0 RC, with Microsoft senior program manager Daniel Rosenwasser saying that “we expect no further changes apart from critical bug fixes.” The full release is planned for March 14th. The big new feature is ECMAScript Decorators, a feature which extends classes via annotations called Decorator expressions.
Decorator expressions are a huge feature and have been work in progress for a long time. Rosenwasser describes it as a “feature that allows us to customize classes and their members in a reusable way.” When a decorator is added to a class method, class field or the class itself, a related decorator function wraps the original with its own additional code. Rosenwasser gives an example that adds logging to every method to which it is applied.
Other features in TypeScript 5.0 include const modifiers for type parameters and enhanced enums. The satisfies operator was introduced in 4.9 as we discussed here, but now in version 5.0 has a related tag that works for the document generator JSDoc. Similarly @overload is now a supported JSDoc tag.
Regarding performance, the TypeScript 5.0 compiler is just over 10 percent faster than before, according to tests.