esprima
esprima copied to clipboard
Feature request: Optional chaining operator
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.
We started using more ES6 syntax recently and also ran into the optional chaining failure. It guess we will have to be more selective until this is supported.
we have had to move to nightly-esprima because of this
it is not implemented (?) although it seems limited to template literal as suggested by the comment
however I cannot understend why: ES6 shouldn't be handled? 57dc451e6d5dc9d692697561e402d532c9f432d0 and as far as i know the proposal passed
you can also try my esprima fork esprima-next wich is in es6 and should work with ES6 code https://github.com/node-projects/esprima-next
Does that work with the Python bindings?
don't know
Object deconstruction like ... not support
we have had to move to nightly-esprima because of this
@sergey-v9 what is that nightly-esprima
? I searched it and it takes me back to the esprima
repository itself.
@Nefcanto yes, it is the same, but bult from the latest version of the code in this repo from 2021 year (while the official last version was 4.0.1 from 2018 year)