A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/microsoft/TypeScript/issues/16 below:

"safe navigation operator", i.e. x?.y ยท Issue #16 ยท microsoft/TypeScript ยท GitHub

Current Status

Open questions

C# and other languages have syntax sugar for accessing property chains where null (or in our case, undefined) might be encountered at any point in the object hierarchy.

var x = { y: { z: null, q: undefined } };
console.log(x?.y?.z?.foo); // Should print 'null'
console.log(x?.baz); // Still an error
console.log(x.y.q?.bar); // Should print 'undefined'

Need proposal on what exactly we should codegen, keeping in mind side effects of accessors.

Edit by @DanielRosenwasser February 27, 2018: This proposal is also called the "null propagation" operator.

AndersDJohnson, pulkit110, svekl, eaigner, Arcitectus and 744 moremind0n, srghma-old, musicm122, kgtkr, PatrickShaw and 33 moresaeedtabrizi, eestein, iygnay, danieloprado, EtherTyper and 68 moreeaigner, Robinson7D, oocx, hcgatewood, hulucc and 207 moreExE-Boss, derekdowling, joshuaobrien, migeorge, isbasex and 23 moremigeorge, isbasex, noway, igor-pavlichenko, jcalz and 13 more


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4