RESSA icon indicating copy to clipboard operation
RESSA copied to clipboard

Optional chaining not supported

Open azw413 opened this issue 3 years ago • 2 comments

Apologies for keeping you busy ! These are very new so I fully understand if you don't support them :-

let vehicle = {
};

let vehicle1 = {
    car: {
        name: 'ABC',
        speed: 90
    }
};


console.log(vehicle.car?.name); // Undefined
console.log(vehicle.car?.speed); // Undefined

console.log(vehicle1.car?.name); // ABC
console.log(vehicle1.car?.speed); // 90

yields the following error :- UnexpectedToken(Position { line: 12, column: 25 }, "Expected {, [, or (; found Punct(Period)")

azw413 avatar Oct 28 '21 10:10 azw413

The general goal is to support features that have made it to stage 3 in the proposal process. In a quick glance across the proposal stages, I wasn't able to find the ? operator, do you know where the proposal is currently?

There is an issue on this repo about currently unimplemented stage 3 features that I try an keep up to date

FreeMasen avatar Oct 28 '21 14:10 FreeMasen

It looks like these are Stage 4 now :- https://github.com/TC39/proposal-optional-chaining https://github.com/tc39/proposal-nullish-coalescing This article describes all the 'new' things in es2020: https://www.w3schools.com/js/js_2020.asp

azw413 avatar Oct 20 '23 08:10 azw413