Bug report or Feature request?
Bug Report
Version (complete output of terser -V or specific git commit)
5.3.1
Complete CLI command or minify() options used
Run via ember-cli-terser.
terser input
return (this.span?.durationSelf && this.span.durationSelf / 1000) ?? null;
terser output or error
return this.span?.durationSelf&&this.span.durationSelf/1e3??null
Causes this error in browser:
SyntaxError: Unexpected token '??'. Coalescing and logical operators used together in the same expression; parentheses must be used to disambiguate.
Expected result
I believe it would work if the following was generated:
return (this.span?.durationSelf&&this.span.durationSelf/1e3)??null
Thanks for reporting!
We also experienced this issue.
The fix was relatively simple. I had to look at the spec for a bit and realized that the precedence rules are weirder than I originally thought :)