TypeScript 4.1 comes packed with new features

The latest version of Microsoft’s programming language TypeScript is now available. TypeScript 4.1 introduced a number of new features, such as template literal types, key remapping in mapped types, and recursive conditional types.

String literal types allow developers to model functions which expect a specific set of strings. Template literal strings can be used to produce a new string literal type. 

TypeScript 4.1 also introduces the ability to re-map keys in mapped types with new “as” clause. This allows developers to utilize features such as template literal types to create property names based off of old ones, Microsoft explained. 

This release also removes certain restrictions on conditional types. Now they can immediately reference themselves within their branches. This makes it easier to write recursive type aliases, the company explained. 

Other new features include –noUncheckedIndexedAccess, paths without baseUrl, checkJs Implies allowJs, React 17 JSX Factories, and Editor Support for the JSDoc @see Tag.

Leave a Reply

Your email address will not be published. Required fields are marked *