Microsoft Announces TypeScript 3.2 RC

Microsoft has announced the TypeScript 3.2 RC the release candidate of its next version of TypeScript.

Microsoft has announced TypeScript 3.2 RC, the release candidate of its next version of TypeScript. The new version includes tweaks affecting binding, working with generics, and new BigInt functionality. 
 
TypeScript 3.2 introduces stricter checking for bind, call, and apply. Now this parameter types from TypeScript 2.0 and Modeling parameter lists with tuple types from TypeScript 3.0, combined together ensures uses of bind, call, and apply are more strictly checked when using a new flag called strictBindCallApply.
  
"When using this new flag, the methods on callable objects are described by a new global type called CallableFunction which declares stricter versions of the signatures for bind, call, and apply. Similarly, any methods on constructable (but not callable) objects are described by a new global type called NewableFunction." explained Daniel Rosenwasser of Microsoft.
 
For generics, TypeScript now allows for using "spreads" on generic types, using the spread operator ("..."), which lets an iterable expand in places where arguments are expected, enabling, for example, taking an object like an array and expanding it into a set of items that can be copied into another array.
 
Rosenwasser explained, for most uses of spreads in JavaScript, users fine model the behavior with intersection types (i.e. Foo & Bar); Object.assign – a function that exhibits most of the behavior of spreading objects is already modeled using intersection types, and there is a very little negative feedback around that.
 
Intersections model the common cases, and they’re relatively easy to reason about for both users and the type system, TypeScript 3.2 now permits object spreads on generics and models them using intersections. 
  1. // Returns 'T & U'  
  2. function merge<T, U>(x: T, y: U) {  
  3.     return { ...x, ...y };  
  4. }  
  5.   
  6. // Returns '{ name: string, age: number, greeting: string } & T'  
  7. function foo<T>(obj: T) {  
  8.     let person = {  
  9.         name: "Daniel",  
  10.         age: 26  
  11.     };  
  12.   
  13.     return { ...person, greeting: "hello", ...obj };  
  14. }  
Generics can also be used with the object rest pattern, which is akin to spreads in that it creates a new object wherein certain properties are excluded.
 
TypeScript 3.2 also features BigInt support, to let coders model theoretically arbitrarily large integers, a feature in an upcoming proposal for ECMAScript, upon which JavaScript and derivatives like TypeScript are based.
 
According to the company, there are plenty more coming up in TypeScript 3.2, and you can see the list of major features it's been working on, at official GitHub page.
 
You can visit the official announcement here.