Today after vs-code made an automatic update, I stumbled over the announcement for the new features in typescript 4.1.

And it absolutely blew my mind. There was the feature, I have been looking for, for almost four years.

I often read over these feature announcements. But this time,… WOW.

In version 4.0 variardic tuples got added. They have been a huge step, allowing to define functions with variable argument lists.

In version 4.1 (wow) there are two features, that together are absolutely powerful, and I wonder if people understand its significance.

• Template Literal Types
This allows to write some logic to determine what values a type can have.

There it is, mapping keys and renaming them with a little computation. This is so huge for developers of ORMs. Otherwise, today, some ORM require to basically define a schema twice, once for the data structure in the database and a second time for typescript. With this new feature a single definition can be enough.

Also validation libraries such as Joi, json-schema, superstruct, can get huge profit from this feature.

and then API frameworks, that have schema definition such as hapi, fastify, graphql, grpc can gain much better type intelliSence for autocompletion with these new features.

The benefits do not end in node.js backend. Also in client side, redux, react-hooks and other libraries, that generate APIs based on a js based type definition or value, will be able to provide awesome typescript user experience, without requiering microsoft to actively support the framework, as it happens with react, angular and vue. (still thank for all the effort making development experiences with these frameworks great)

Wow, are you also that excited about these updates? I believe they are game changing and and will improve our development experiences not only with typescript, but in the javascript ecosystem in a whole.