TypeScript 5.0: New Decorators Standard, Smaller npm
TypeScript 5.0 shipped this week, with support for the new decorators standard and a smaller npm footprint than TypeScript 4.9.
Microsoft’s Daniel Rosenwasser, programmer manager for TypeScript, explained the changes in a blog post, promising that 5.0 “is not a disruptive release, and everything you know is still applicable.” TypeScript 5.0 includes correctness changes and some deprecations for infrequently-used options, he added.
“This release brings many new features, while aiming to make TypeScript smaller, simpler, and faster,” Rosenwasser said. “We’ve implemented the new decorators standard, added functionality to better support ESM projects in Node and bundlers, provided new ways for library authors to control generic inference, expanded our JSDoc functionality, simplified configuration, and made many other improvements.”
“Decorators, in a nutshell, involve wrapping a piece of code such as a function or a class with another — a decorator function. The aim is to extend the functionality of the wrapped code without modifying it,” wrote Eagles. “Decorators are very powerful and they have a wide range of applications.”
Among the use cases are turning the class method into REST, logging useful information and enabling code reuse, he added.
The new release also offers a smaller typical npm package size, at 37.4 MB compared to 63.8 MB for Typescript 4.9, according to Rosenwasser’s write-up.
npm install -D typescript
React.dev Launches New React Home
In other news from the week, React.dev is nearing its 10th birthday. To celebrate, it has launched a new home for the popular library and related documentation. The site teaches modern React with function components and hooks, and features more than 500 new interactive examples and sandboxes.
- Learn React, a self-paced course that teaches React from scratch and incorporates a “show solution” button for those who get stuck.
- API Reference, which provides the details and usage examples for every React API. Every API page includes information about reference and usage, with usage showing why and how a developer would use an API in practice.
The new site offers a quick start page for those wanting to learn React, along with an interactive Tic-Tac-Toe tutorial that teaches developers to build a version of the game. It also includes an update to Thinking in React, which Abramov and Nabors said is “the tutorial that made React “click” for many of us.
Rust Update to 1.68.1
Finally, Rust published a new point release, Rust 1.68.1, on Thursday. Point releases are minor, typically fixing bugs or performing code cleanup. In this case, Rust 1.68.1 contains a change to how Rust’s CI builds the Windows MSVC compiler, no longer enabling LTO for the Rust code.
“This led to a miscompilation that the Rust team is debugging, but in the meantime, we’re reverting the change to enable LTO,” the Rust team stated in a blog post. “This is currently believed to have no effect on the wider usage of ThinLTO. The Rust compiler used an unstable flag as part of the build process to enable ThinLTO despite compiling to a dylib.”
Other regressions fixed in the release:
◦ Fix building the compiler with –enable-local-rust;
◦ Treat $prefix-clang as clang in linker detection code; and
◦ Fix a panic in the compiler.