News

TypeScript 2.0 Beta Supports Nullable Types

Besides support for nullable types, a beta of TypeScript 2.0 is now available that includes a smoother way of working with declaration files and makes module declarations more efficient.

A beta version of TypeScript 2.0 is now available from Microsoft, packed with a handful of features, including a smoother way of working with declaration files, support for nullable types, and simpler module declarations.

Declaration files are used to describe the shape of an external JavaScript library or host API, and a blog from Microsoft's Daniel Rosenwasser describes how the process of acquiring and declaring files is being simplified in version 2.0. Developers currently have to use package managers like tsd or Typings to use declaration files from the DefinitelyTyped declaration files repository (where library authors store .d.ts files).

"While very useful, these were extra tools to learn, and this added friction for new users," writes Rosenwasser, in a Github discussion posted here. "There were also some technical issues, such as lack of versioning and conflicting declarations, that existing tools couldn't manage." In beta 2.0, much of the process is being simplified so that developers just need to use the npm package manager to declare files.

In relation to file declaration, the TypeScript 2.0 beta has an easier way to declare modules. Modules can be declared without having to define their shapes until later. Wildcards can also be used in declarations for more efficient coding.

TypeScript 2.0 also includes two new types, null and undefined, which allows for nullable types. "They're not totally useful on their own, but you can use them in a union type to describe whether something could be null/undefined," writes Rosenwasser. It also adds a --strictNullChecks flag to check for the contents of a string.

Rosenwasser notes that handling of nullable types is a result of TypeScript 2.0's use of control flow analysis "to better understand what a type has to be at a given location," which has benefits in less debugging later on.

See Rosenwasser's blog here for some code samples, as well as links for getting the beta.

TypeScript is Microsoft's implementation of the JavaScript, a programming language for developing dynamic Web pages. TypeScript is considered a superset, adhering to JavaScript's language but allowing for extending of the JavaScript language. The latest version, 1.8, was released in February with JavaScript compilation improvements, expanded JSX support, and ChakraCore support.

About the Author

Michael Domingo is a long-time software publishing veteran, having started up and managed several developer publications for the Clipper compiler, Microsoft Access, and Visual Basic. He's also managed IT pubs for 1105 Media, including Microsoft Certified Professional Magazine and Virtualization Review before landing his current gig as Visual Studio Magazine Editor in Chief. Besides his publishing life, he's a professional photographer, whose work can be found by Googling domingophoto.

comments powered by Disqus

Featured

  • Kubernetes for Developers

    Microsoft's Dan Wahlin previews his introductory "Kubernetes for Developers" session at Visual Studio Live! San Diego 2026, explaining how developers can get past the Kubernetes learning curve by starting locally, mastering Pods first, and using Services to make containerized applications reliably accessible.

  • VS Code Keeps Eye on Costs in v1.126 Update

    Visual Studio Code 1.126 adds session-level Copilot cost information, continuing Microsoft's recent focus on helping developers monitor and manage usage-based GitHub Copilot billing.

  • Open VSX 1.0.0 Puts Focus on Open Extension Registry for VS Code Ecosystem

    Eclipse Open VSX has reached 1.0.0, highlighting its role as a vendor-neutral registry for VS Code-compatible extensions.

  • Infragistics Puts MCP Toolchain at Center of Ultimate 26.1

    Infragistics Ultimate 26.1 introduces the Ignite UI Enterprise MCP toolchain for AI-assisted app development across Angular, React, Web Components and Blazor.

Subscribe on YouTube