Feature request: Optional chaining operator
Author: RosuavCreated Mar 18, 2022Updated Jun 20, 2023
Steps to reproduce
esprima.parse('foo?.bar')Expected output
Some indication that this is optional chaining (if foo exists, it's the same as foo.bar, else it's undefined)
Actual output
"Unexpected token ."
Relevant references
https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#prod-OptionalExpression
This is supported in all major browsers and Node.js.
Source: jquery/esprima