You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
new A()?.b() is still invalid JS (not true, see comments below). What's interesting is that when targeting esnext, the code is emitted as-is (and is a runtime error), but downlevel emit is doing the equivalent of (new A)?.b() instead.
Ah, you're right, I thought I had tried it and gotten an "invalid optional chain" error. But yeah, really weird because the esnext emit preserves the runtime SyntaxError while the downlevel emit changes the meaning of the code.
Bug Report
π Search Terms
syntax error optional chain new arguments parentheses
π Version & Regression Information
Only tested with 4.7 Nightly in the playground
β― Playground Link
Playground link with relevant code
π» Code
Output
Compiler Options
Playground Link: Provided
π Actual behavior
new A?.b()
is parsed as if it wasnew A()?.b()
π Expected behavior
It should be a syntax error, because it's not valid JavaScript syntax.
The text was updated successfully, but these errors were encountered: