Feature request: Optional chaining operator
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 773
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the esprima.parse('foo?.bar') entry point and compare the requested OptionalExpression reference with the parser's current handling of the input. The work is done when optional chaining is accepted and produces an AST representation rather than the current "Unexpected token ." error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100