Google Apps Script - optional chaining throwing ParseError

474 views Asked by At

Why doesn't google Apps Script support latest javascript features like optional chaining even though it's running on Chrome V8? When optional chaining is used, clasp is throwing an error.

GaxiosError: Syntax error: ParseError: Unexpected token .

The runtime environment is already mentioned in the manifest file appsscript.json as:

{
    ...
    "runtimeVersion": "V8",
    ...
}
1

There are 1 answers

2
TheMaster On BEST ANSWER

Optional chaining now works.


Currently, this feature(optional chaining) is not supported. A bug report was raised and was denied by Google:

Status: Won't Fix (Infeasible) Hello, Currently this operator does not work on Apps Script. V8 allows you to run modern syntax, but not all of the newly released features. You can check the information in ⁠V8 Runtime Overview To sum up, apps script v8 is not javascript. Regards.

You may however be able to raise a feature request for the same(This is NOT a bug report).