News

What's New in TypeScript 5.5, Now Generally Available

Microsoft shipped the latest iteration of its type-infused superset of JavaScript, TypeScript 5.5, introducing inferred type predicates, control flow narrowing, JSDoc @import and other enhancements.

"Although JavaScript is used to create cross-platform apps, it wasn't conceived for large apps involving thousands, or even millions, of lines of code," Microsoft explains. "JavaScript lacks some of the features of more mature languages that power today's sophisticated applications. Integrated development editors (IDEs) can find it challenging to manage JavaScript and maintain these large code bases.

"TypeScript addresses the limitations of JavaScript, doing so without compromising the key value proposition of JavaScript: the ability to run your code anywhere and on every platform, browser, or host."

Early this year, the firm RedMonk placed TypeScript at No. 6 (in a tie with CSS) in its language rankings.

TypeScript Tied for 6th
[Click on image for larger view.] TypeScript Tied for 6th (source: RedMonk).

Here's a summary of new features in v5.5, as described in a June 20 announcement.

  • Inferred Type Predicates: Automatically infers type predicates for functions that return boolean values, allowing TypeScript to better understand and narrow types based on the function's return type.
  • Control Flow Narrowing for Indexed Accesses: Enhances type narrowing for constant indexed property accesses, improving type checking precision and reducing potential errors.
  • JSDoc @import Tag: Introduces a new JSDoc tag to simplify importing types in JavaScript projects, making it easier to integrate TypeScript's type checking capabilities.
  • Regular Expression Syntax Checking: Adds syntax validation for regular expressions, ensuring they are correctly formed and reducing runtime errors.
  • New ECMAScript Set Methods: Supports new ECMAScript methods such as union, intersection, and difference for Set objects, aligning with the latest ECMAScript standards and enhancing functionality.
  • Isolated Declarations: Introduces the --isolatedDeclarations option, allowing developers to generate declaration files without requiring a full type check, speeding up the build process.
  • The ${configDir} Template Variable for Configuration Files: Adds a template variable for specifying paths in configuration files, providing more flexibility in project setups.
  • Consulting package.json Dependencies for Declaration File Generation: Uses dependencies listed in package.json to assist in generating declaration files, ensuring accurate type definitions.
  • Editor and Watch-Mode Reliability Improvements: Enhances reliability and performance in editor integrations and watch mode, providing a smoother development experience.
  • Performance and Size Optimizations: Includes various optimizations to improve compiler performance and reduce the size of generated output, making builds faster and more efficient.
  • Easier API Consumption from ECMAScript Modules: Simplifies the process of consuming APIs from ECMAScript modules, improving interoperability and developer experience.
  • The transpileDeclaration API: Introduces a new API for transforming TypeScript declarations, offering more control and customization for advanced use cases.

The next version, TypeScript 5.6, is expected to ship in early September, with iteration plans listed on the GitHub-hosted issue tracker.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube