Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

Typescript 3.3 is finally released!

Save for later
  • 3 min read
  • 01 Feb 2019

article-image

After releasing TypeScript 3.3 RC, two weeks ago, yesterday Microsoft announced the availability of TypeScript 3.3. TypeScript 3.3 contains no breaking changes and is a comparatively smaller release than usual.

What’s new in Typescript 3.3

Better behavior when calling union types


When there is a union type A | B, TypeScript now allows users to access all of the properties common to both A and B. For example, the intersection of members. You can get a property from a union type only if it’s known to be present in every union type. When every type has only one signature with identical parameters, things work. Such a restriction was too much and have errors in some areas. So, in TypeScript 3.3, the following code as shown in the blog will work:

type Fruit = "apple" | "orange";

type Color = "red" | "orange";

type FruitEater = (fruit: Fruit) => number;     // eats and ranks the fruit

type ColorConsumer = (color: Color) => string;  // consumes and describes the colors

declare let f: FruitEater | ColorConsumer;

f("orange"); // It works! Returns a 'number | string'.

f("apple");  // error - Argument of type '"apple"' is not assignable to parameter of type '"orange"'.

f("red");    // error - Argument of type '"red"' is not assignable to parameter of type '"orange"'.


The parameters of the above signatures are ‘intersected’ to create a new signature. When the impossible intersections are gone, what remains is “orange” & “orange” which is just “orange”. That is not to say there are no restrictions. The new behavior is active only when only one type in the union has multiple overloads and a generic signature. The forEach method will now be callable, but there may be some issues under noImplicitAny.

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at £16.99/month. Cancel anytime

--build --watch use incremental file watching


In TypeScript 3.3, --build mode’s --watch flag leverage incremental file watching. This results in significantly faster builds with a reduction of 50% to 75% in build times of the original --build --watch times.

Sublime Text supports JavaScript editing


The TypeScript plugin for Sublime Text now supports editing in JavaScript files. Users will now get more accurate completions, rename, go-to-definition, and more in JavaScript code that utilizes JSDoc and interoperates with TypeScript code.

Typescript recently announced the ‘TypeScript Roadmap’ for January 2019- June 2019 which outlines the priorities that the team will be focussing on, over the next 6 months.

Future of ESLint support in TypeScript

PayPal replaces Flow with TypeScript as their type checker for every new web app

npm JavaScript predictions for 2019: React, GraphQL, and TypeScript are three technologies to learn