Jump to content

TypeScript 3.2 now available


nir

Recommended Posts

Microsoft has announced a new update to its open-source, superset of the JavaScript programming language. TypeScript 3.2 adds a number of new features such as improved narrowing for tagged unions, error message improvements and editing enhancements.

 

NuGet users and Visual Studio 2015 users should be aware that with this release and future releases, the team will only be shipping a MSBuild package instead of a standalone compiler package, which will depend on an invokable version of Node.js, according to the company.

 

“If you’re unfamiliar with TypeScript, it’s a language that brings static type-checking to JavaScript so that you can catch issues before you even run your code – or before you even save your file. It also includes the latest JavaScript features from the ECMAScript standard on older browsers and runtimes by compiling those features into a form that they understand,” Daniel Rosenwasser, program manager of TypeScript, wrote in a post. But beyond type-checking and compiling your code, TypeScript also provides tooling in your favorite editor so that you can jump to the definition of any variable, find who’s using a given function, and automate refactorings and fixes to common problems.”

 

Some of the major features of this release include:

 

strictBindCallApply

The latest release comes with stricter checking for bind, call and apply. “In JavaScript, bind, call, and apply are methods on functions that allow us to do things like bind this and partially apply arguments, call functions with a different value for this, and call functions with an array for their arguments,” Rosenwasser wrote. “Unfortunately, in its earlier days, TypeScript lacked the power to model these functions, and bind, call, and apply were all typed to take any number of arguments and returned any. Additionally, ES2015’s arrow functions and rest/spread arguments gave us a new syntax that made it easier to express what some of these methods do – and in a more efficient way as well.”

 

To address this, Microsoft added parameter types from TypeScript 2.0 and modeling parameter lists with tuple types in TypeScript 2.0. These enable bind, call and apply to be abstracted accurately without hard coding, the company explained. Combined, the two create strictBindCallApply, which declare stricter versions. However, Rosenwasser explained a caveat of this is that it is not able to fully model generic functions or functions with overloads.

 

Source

Link to comment
Share on other sites


  • Views 563
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...