I installed the latest TypeScript nightly (Version 3.7.0-dev.20190924
) so I could try optional chaining (?.
) support, but I am getting error TS1109: Expression expected
.
Is there a compiler flag I need to set besides strict = true
?
EDIT: This answer is obsolete, due to new versions of typescript. Rejoice!
Original answer:
It appears the support for optional chaining has not yet been merged: https://github.com/microsoft/TypeScript/pull/33294
You might be able to get access to it by installing that specific branch. In your package.json you would indicate this as:
"typescript": "git+https://github.com/microsoft/TypeScript.git#optionalChainingStage3",
However, i gave it a quick try and was still getting syntax errors even with that branch, so there may be flags that are needed, or the code in the branch may be in an unstable state right now. Or maybe my setup may have some other issue that doesn't work with it yet.