9 stories
today

TypeScript 3.0, Microsoft’s extension of JavaScript, his general availability

Microsoft this week announced the general availability of TypeScript 3.0, their extension of JavaScript. This version comes with a few breaking changes, and a new scalable way to structure projects (via Neowin.)

To grab up this latest version of TypeScript, all you need to do is enter the “npm install -g typescript” command in your Node Package Manager. Once updated, you’ll see the following new changes.

  • Project references allow TypeScript projects to depend on other TypeScript projects – specifically, allowing tsconfig.json files to reference other tsconfig.json files. Specifying these dependencies makes it easier to split your code into smaller projects.
  • TypeScript 3.0 allows us to better model scenarios by now allowing rest parameters to be generic, and inferring those generics as tuple types.
  • TypeScript 3.0 introduces a new type called unknown. Much like any, any value is assignable to unknown; however, unlike any, unknown is assignable to almost nothing else without a type assertion.
  • In TypeScript 3.0, error messages can provide messages on other locations so that users can reason about cause-and-effect of an error.
  • Support for defaultProps in JSX
  • TypeScript now provides two new productivity features around JSX: providing completions for JSX closing tags
    and providing collapsible outlining spans for JSX

With TypeScript 3.0, editor support will be in Visual Studio 2017 (for version 15.2 or later,) Visual Studio 2015 (which requires update 3,) and Sublime Text 3 via PackageControl. It also will come to other popular editors over time. Microsoft’s Daniel Rosenwasser dives deeper into the changes over on the MSDN Blog, so be sure to check it out.

Further reading: , ,

Are you already using TypeScript 3.0?