TypeScript 5.6 has been released. The update has better handling of truthy and nullish checks and new iterator helper methods.
TypeScript, the a superset of JavaScript that adds optional static types which can be checked by the TypeScript compiler to catch common errors in your programs, is now much more widely used than JavaScript itself, according to both the Stack Overflow Developer Survey and the State of JavaScript Survey, see The Ongoing State Of JavaScript. Part of the reason for TypeScript's popularity is perhaps its ability to help you avoid about mistakes like typos, missing arguments, or forgetting to check for null and undefined and the latest release go9es further in eliminating bugs.
The first improvement to TypeScript 5.6 is in the way it handles checks for truthy and nullish. In the past, expressions that have "static truthy semantics" were allowed. Such expressions always evaluate to the same truthiness, and the TypeScript team says that when experimenting, they found that many bugs could be caught by flagging up code that always evaluates in a specific way, to be either always truthy or always nullish. In TypeScript 5.6, the compiler now returns an error when it can syntactically determine a truthy or nullish check will always evaluate in a specific way. However, some expressions still are allowed even if truthy or nullish. The list of allowable expressions include true, false, 0, and 1.
Iterator helper methods have also been added to this release. The improvement adds methods previously limited to arrays onto most of the iterators that are produced in JavaScript. Iterables are things that you can iterate over over by calling a [Symbol.iterator]() to get an iterator, while iterators are things that have a next() method that can be used to get the next value as you iterate. The TypeScript team says developers use iterables in all sorts of places in JavaScript, but until now had missing methods on Arrays like map, filter, and reduce. This release adds those and other methods onto most of the IterableIterators that are produced in JavaScript.
Another addition, strict built-in iterator checks, arose from the addition of interator helper methods. The developers say that with the new IteratorObject type, they discovered some difficulties in allowing safe implementations of IteratorObjects. This added to a long standing safety issue with IteratorResult in cases where TReturn was any, which is the default.
While it would be hard to fix the problem on every Iterator without introducing a lot of breaks, the team says they can at least fix it with most IteratorObjects that get created. TypeScript 5.6 introduces a new intrinsic type called BuiltinIteratorReturn and a new --strict-mode flag called --strictBuiltinIteratorReturn. Whenever IteratorObjects are used in places like lib.d.ts, they are always written with BuiltinIteratorReturn type for TReturn. This will produce an accurate and type-safe return type for the next() methods of iterators produced by built-ins like Array, Set, and Map.
TypeScript 5.6 is available now.
- Ian Elliot is the author of Just JavaScript: An Idiomatic Approach ; JavaScript Async ; Just jQuery: The Core UI ;Just jQuery: Events, Async & AJAX and JavaScript Bitmap Graphics with Canvas. All these titles are part of theI Programmer Librarypublished by I/O Press .
More Information
Related Articles
TypeScript 5.5 Adds ECMAScript Set Support
Node.js Adds Experimental TypeScript Support
TypeScript 5 - Smaller, Simpler, Faster
The Ongoing State Of JavaScript
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Google AI Studio Does Angular
27/10/2025
Google's AI Studio can now generate Angular applications. Add the Web Codegen Scorer tool on top and you get a pretty solid Angular development platform.
Missing The Point Of LLMs
22/10/2025
Financial pundits are trying to frighten us into thinking that the "AI bubble" is about to burst and even AI researchers are backtracking, casting doubt on LLMs. Both are wrong - the progress towards [ ... ]
- Robot Army Video As Robots Shipped En Masse
- Eclipse Foundation Adds Agentic Functionality To Eclipse LMOS
- What Does JetBrains Survey Tell Us About AI
- Edera Open Sources Sprout
- Memgraph Adds AI Graph Toolkit
- PyTorch Team Introduces Cluster Programming
- InfluxDB 3.6 Released With AI Capabilities
- Apple Extends Bug Bounty Program
- Join The Protest Against The Closing Of Android
- Qodana Revisited
- The Pico Gets Zephyr And Rust Support
- Microsoft Announces GitHub Copilot App For Java And .NET
- Next.js 16 Adds Cache Components
Comments
or email your comment to: comments@i-programmer.info