• Home
  • Interviews
  • Business Wisdom
  • Tech & Business
  • Business News
  • Economy
  • Community
  • Login
ValiantCEO
  • Home
  • Interviews
  • Business Wisdom
  • Tech & Business
  • Business News
  • Economy
  • Community
No Result
View All Result
ValiantCEO
  • Home
  • Interviews
  • Business Wisdom
  • Tech & Business
  • Business News
  • Economy
  • Community
No Result
View All Result
valiant
No Result
View All Result

TypeScript 4.2 tunes tuple types

Jarvis Dobrik by Jarvis Dobrik
March 1, 2021
in Tech & Business
TypeScript 4.2 tunes tuple types
alphabetic letters characters language by andybrandon50 cc by sa 2 0 1500x1000 100794409 large

Microsoft has published a beta version of TypeScript 4.2, an update to the popular open source language that adds types to JavaScript. With a final release due February 23, TypeScript 4.2 features enhancements pertaining to tuple types and type aliases.

TypeScript 4.2, launched January 12, expands the ways rest elements in tuple types can be used. Previously, TypeScript only permitted rest elements in the last position of a tuple type. Now, rest elements can occur almost anywhere within a tuple, with a few restrictions. A rest element cannot be followed by another optional element or rest element, and only one rest element is permitted per tuple.

[ Also on InfoWorld: The most valuable software developer skills to get hired now ]

TypeScript 4.2 also includes these changes and enhancements:

  • With smarter type alias preservation, internals are smarter. Type construction is tracked. The language also tracks type aliases to instances of other aliases. The ability to print back types based on how they are used means avoiding some overly large types being displayed, which can translate to better .d.ts file output, error messages, and in-editor type displays in quick info and signature help.
  • Template string expressions now always start with template literal types. Like string literal types, these types disappear and turn into string through a process known as widening, if one of the values is assigned to a mutable variable. Template literal types were introduced in TypeScript 4.1, the current production release. These types can model specific patterns of strings.
  • Stricter checks are featured for the in operator. With JavaScript, using a non-object type on the side of the incode operator results in a runtime error. TypeScript 4.2 ensures this can be caught at design time.
  • An abstract modifier can be specified on constructor signatures.
  • An --explainFiles flag helps developers understand why a file is in a program.
  • Rules have been relaxed between optional properties and string index signatures.
  • Type arguments will be parsed in a more spec-compliant manner. A breaking change, this could impact developers who use TypeScript’s API to parse type constructs in JavaScript files.
  • The in operator no longer allows primitive types on the right side. This also is a breaking change.

The TypeScript 4.2 beta can be installed via NuGet or via NPM using the following command:

npm install typescript@beta

Tags: Tech
Previous Post

New York City is latest to cut ties with Trump businesses

Next Post

5 Digital Advertising Tips That You Need to Know

Jarvis Dobrik

Jarvis Dobrik

Valuer | Photographer | Writer Motivating the world through Entrepreneurship and Self-Growth Quality over quantity.

Next Post
5 Digital Advertising Tips That You Need to Know

5 Digital Advertising Tips That You Need to Know

Please login to join discussion
Chris Cheang
Interviews

Chris Cheang – Post Capital – Investing in Companies With Repeat or Recurring Revenue Models Across a Wide Range of Industries

by Jed Morley
May 27, 2022
0

"One of the most important qualities of a successful executive from Post Capital’s perspective is a CEO’s willingness to get...

Read more
The Watches of NFL Stars

The Watches of NFL Stars

May 27, 2022
Itzik Levy

Itzik Levy – vcita – Empowering Small Businesses With Digital Transformation

May 27, 2022
9 Tips To Look Perfect When You Wear A Red Leather Jacket

9 Tips To Look Perfect When You Wear A Red Leather Jacket

May 27, 2022
How to Build a Company Location Map

How to Build a Company Location Map

May 27, 2022

Valiant CEOs & Entrepreneurs Share, Inspire, and Celebrate Outrageously Successful Ethical Businesses and their Leaders.

Contact Us

staff@valiantceo.com

Follow Us

Browse by Category

  • Business News
  • Business Wisdom
  • Interviews
  • Community
  • Tech & Business
  • Economy

Links

  • About us
  • Cookie Policy
  • Editorial Policy
  • Privacy & Policy
  • Contact
  • VIP Author

Recent News

Chris Cheang

Chris Cheang – Post Capital – Investing in Companies With Repeat or Recurring Revenue Models Across a Wide Range of Industries

May 27, 2022
The Watches of NFL Stars

The Watches of NFL Stars

May 27, 2022

© 2021 ValiantCEO - All rights reserved

No Result
View All Result
  • Home
  • Interviews
  • Business Wisdom
  • Tech & Business
  • Business News
  • Economy
  • Community

© 2021 valiantceo

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In