News

TypeScript 2.1 Is Now Smarter Than Ever

It's like a better version of TypeScript 2.0, only this incremental update adds "smarter" inference and a bevy of other improvements.

New this week is a version of TypeScript 2.1 that follows the version 2.0 release of nearly a month ago, only this one is naturally better. It's better in that it adds "smarter" inference for better tooling and a handful of small but important improvements to try out.

"TypeScript 2.1 now makes it easier to model scenarios where you might incrementally initialize variables," writes Microsoft Program Manager Daniel Rosenwasser, in a blog. "Since a lot of code is written like this in JavaScript, this makes it even easier to migrate existing codebases to TypeScript."

Rosenwasser holds up the any type as an example in his post: TypeScript will assign an implicit any type to a variable if one isn't assigned to it. That's all well and good with earlier versions, but he said that "[w]ith TypeScript 2.0 we built out a foundation of using control flow analysis to track the flow of types throughout your program. Because that analysis examines the assignments of every variable, we've leveraged that same foundation in TypeScript 2.1 to more deeply examine the type of any variable that seems like it's destined for a better type." So, TypeScript no longer assigns any to a variable, but smartly infers the variable's type based on what you assign to it.

TypeScript 2.1 also has support for async/await. If this capability looks familiar, Rosenwasser notes that it has existed in earlier versions of TypeScript that were used to target ES6 and ES 2015. "TypeScript 2.1 brings the capability to ES3 and ES5 runtimes, meaning you'll be free to take advantage of it no matter what environment you're using," he writes.

On a side note, on the GitHub page for TypeScript there's also a nifty roadmap of features coming in subsequent releases. The notes shows that support for project references, addition of variadic types and partial types, and support for type-checking of computed properties for constants and symbols are expected in the next update.

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

  • Low-Coding in the Age of AI: Dataverse Embraces Copilot, Claude and Cursor

    Microsoft is extending Dataverse into coding-agent marketplaces while expanding its MCP tools, certification program and governance controls.

  • Visual Studio Takes Aim at Copilot Billing Shock

    Beyond Copilot usage visibility, the June update delivers several other enhancements centered on AI-assisted development, security and quality-of-life improvements. Here's a quick rundown of the remaining additions announced by Microsoft.

  • Claude AI Gets Yet Another Boost in VS Code 1.128

    The July 8, 2026, Visual Studio Code update expands agent workflows, chat attachments, browser-tab controls, OS-level shortcuts and enterprise telemetry management.

  • TypeScript 7 Arrives to Rock VS Code with Go-Powered Speed

    Microsoft says TypeScript 7, announced July 8, brings native Go performance to VS Code, Visual Studio and other editors.

Subscribe on YouTube