jquery / jquery/esprima

Feature request: Optional chaining operator

Open
#2,112 9 comments 3 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.