Home / Tech News / TypeScript 3.5 Released with ‘Omit’ Helper, Excess Property Checks and More

TypeScript 3.5 Released with ‘Omit’ Helper, Excess Property Checks and More

Just after the release of TypeScript 3.4 two months ago, Daniel Rosenwasser, Program Manager at TypeScript, announced the release of TypeScript 3.5 yesterday.

The version has a lot of new additions and improvements in the language, compiler, editor and some most awaited features as well. So, let’s have a look at some changes in the language and compiler first, then we will discuss improvements in the editing tools.

Also Read: Difference Between TypeScript and Javascript Programming

typescript programming language

Compiler and Language

The ‘Omit’ Helper Type

A brand new version of ‘Omit’ has been defined in the TypeScript 3.5. It includes its own lib.d.ts which can be used wherever you want. Not only the users but the compiler will itself use ‘Omit’ type to express types created by object rest, destructuring declarations on generics.

Improved Excess Property Checks in Union Types

In the earlier versions of TypeScript, certain excess properties were allowed in the object literal, even when they didn’t match between Point and Label. TypeScript now comes with a feature for excess property checking in object literals. The type-checker will verify that all the provided properties belong to some union member with the appropriate type.

Smarter Union Type Checking

TypeScript compares each constituent type while checking against union types in isolation. The process basically involves checking whether is source type is assignable to target. In the latest version of TypeScript, when you assign to types with discriminant properties like in T, the language go even further and decomposes types like S into a union of every possible inhabitant type. The TypeScript was lacking this in the earlier versions.

Speed Improvements

Since TypeScript 3.3, the development team has been heavily focusing on optimizing certain code paths and stripping down certain functionality. As a result, the new version is a way faster than both of the previous versions. There’s a significant decrease in the compile time and other editor operations would be much faster. Lastly, in TypeScript 3.5, the amount of rebuilding time is reduced by 68% as compared to TypeScript 3.4.

Read: Microsoft Launches Bosque: An Open Source Programming Language

New Editing Tools

Extract to Type Alias

TypeScript 3.5 comes with a whole new refactoring system that allows you to extract types to local type aliases. However, there’s still room for improvement. If you are someone who prefers interfaces over type aliases, you may face some issues while extracting object types to interfaces.

Smart Select

This feature will provide an API and enable developers to expand text selections further in a syntactical manner. Smart Select is a cross-platform feature and available for every editor which can appropriately query TypeScript’s language server.

Object.keys Reject Primitives in ES5

In ECMAScript 5, if you pass Object.keys through any non-object argument, it will throw an exception. In TypeScript 3.5, if your target is ES5, calls to Object.keys must pass a valid object. This change interacts with the change in generic inference from {} to unknown.

Also Read: JavaScript: The Best and Worst Programming Language

Final Words

The main goal of the new version of TypeScript is to make the coding experience faster and happier. The company has already given the iteration plan document for the next version of TypeScript. It’s a kind of roadmap for users to get an idea of what they can expect for the upcoming version. If you feel that I’ve missed some important feature or change, make sure to share with us in the comments below.

Loading...

>> Source Link

Check Also

3 tech career deals you may have missed

Tech has invaded pretty much every aspect of our lives nowadays, making things easier and …

%d bloggers like this: