Just a note: Please be conservative about using this in m-c while it's not enabled in release yet, to avoid issues when uplifting patches. Otherwise, I think this is a great new feature that I'd love to use.
On Wed, Jan 22, 2020 at 4:30 PM Patrick Brosset <pbros...@mozilla.com> wrote: > Thanks Yulia, this is going to be very useful and helpful in reducing code > complexity! > > For info, here's a DevTools bug to make sure the console panel still > supports autocompletion even when ?. is used: > https://bugzilla.mozilla.org/show_bug.cgi?id=1594009 > I also a question: do you know if eslint is ready for this new syntax? In > other words, can we use it in m-c without causing eslint parsing errors? > > On Tue, Jan 21, 2020 at 8:11 PM Yulia Startsev <yu...@mozilla.com> wrote: > > > Hi, > > > > In Firefox 74, we'll ship the optional chaining operator. > > > > *Bug: *https://bugzilla.mozilla.org/show_bug.cgi?id=1566143 > > *Standard: *https://tc39.es/proposal-optional-chaining/ > > *Platform coverage: *All, no pref > > *DevTools bug: *N/A. > > *Other browsers:* Shipping in Chrome, Shipping in Safari > > *Testing: * > > > > > https://github.com/tc39/test262/tree/master/test/language/expressions/optional-chaining > > < > > > https://github.com/tc39/test262/tree/master/test/language/expressions/coalesce > > > > > > > *Use cases: *Optional chaining may be useful in cases where a property > may > > be conditionally present. This affects property access, dynamic property > > access, and function calls in the following way: > > > > *Property access* > > > > Before > > const street = user.address && user.address.street; > > > > After > > const street = user.address?.street; > > > > *Dynamic Property Access* > > Before > > const street = user.address && user.address["street"]; > > > > After > > const street = user.address?.["street"]; > > > > *Optional function calls:* > > > > Before > > const result = myObj.method && myObj.method(); > > > > After > > const result = myObj?.method(); > > > > > > *Secure contexts:* This is a JS language feature and is therefore present > > in all contexts. > > _______________________________________________ > > dev-platform mailing list > > dev-platform@lists.mozilla.org > > https://lists.mozilla.org/listinfo/dev-platform > > > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform