Js2Py icon indicating copy to clipboard operation
Js2Py copied to clipboard

Optional chaining (?.) is not supported.

Open seyyedaliayati opened this issue 2 years ago • 0 comments

Consider the following code snippet from Mozilla Web Docs:

const adventurer = {
  name: 'Alice',
  cat: {
    name: 'Dinah'
  }
};

const dogName = adventurer.dog?.name;
console.log(dogName);
// expected output: undefined

console.log(adventurer.someNonExistentMethod?.());
// expected output: undefined

This syntax is not supported by js2py. I got the following error message when parsing:

js2py.internals.simplex.JsException: SyntaxError: Line 9: Unexpected token .

seyyedaliayati avatar May 30 '22 06:05 seyyedaliayati