TypeScript 3.7 released: Optional Chaining implemented – soon also in ECMAScript?

Alex Alex 06 November 2019
TypeScript 3.7 released: Optional Chaining implemented – soon also in ECMAScript?

TypeScript 3.7 is here and with it brings Support for Optional Chaining. So TypeScript is one of the pioneers of the JavaScript world. ECMAScript, however, could follow suit soon. What about the applicability of the new Operators in practice?

TypeScript 3.7 is there. The new Version brings a series of already announced Features that could already be in the Beta - and RC-Phase is the Version tested. Including a Feature in particular stands out: the Optional Chaining. Thus, it is in TypeScript now possible for Code execution to abort, if null or undefined occurs.

is This Feature already for a while in conversation and, as you can see from the Blogpost on the Release of TypeScript 3.7, of a Requested the most for the JavaScript language. In ECMAScript the Feature to be standardized soon. The corresponding Proposal is implemented is currently at the Test stage in the Standardisierungsporzess and is in various Tools and Browser. In December, the Committee will vote behind ECMAScript, whether the design be considered as completed, and thus, in 2020 the Standard is expected to respond.

The Central Feature for Optional Chaining in TypeScript 3.7 the ?Operator, which is used for the optional Property Access. A simple example is the Release Notes the following Code:

a
let x = foo?.bar.baz();

Thus foo is.bar.baz() is only executed if the foo is defined. This is not the case, the execution in the question mark.

Optional Chaining: Low Browser compatibility

The Browser is Support for the new Feature is still low. The ECMAScript Proposal is yet support, according to MDN only from Chrome and Chrome for Android behind the Flag Experimental JavaScript, as well as Opera for Desktop devices, starting with Version 65. Here, too, the Support is hidden but behind the Flag. In the Tooling area of the not is arrived Optional Chaining is also everywhere. So on Reddit of problems with the use of the new TypeScript-Operator with Prettier is reported. For Babel, a Plug-in available, which can be used to have problems with Browser compatibility address. the

the
the
the
the

Source: entwickler.de

Comments (0)

    No comments yet

You must be logged in to comment.