Closed CharlieEriksen closed 1 year ago
Version used
3.0.1
Describe the bug The ToJavascriptString produces some odd code. It turns:
ToJavascriptString
return n || o === "back" ? (n ?? "") || "back" : "";
into:
return n || o === "back" ? n ?? "" || "back" : "";
To Reproduce
[Fact] public void TestCatch() { string javascriptCode = @"let Button$1 = class { get iconSource() { var { icon: n, type: o } = this.props; return n || o === ""back"" ? (n ?? """") || ""back"" : """"; } }; "; var parsed = new JavaScriptParser(new ParserOptions(){Tolerant = true}); var node = parsed.ParseModule(javascriptCode); node.Should().NotBeNull(); var prettied = node.ToJavaScriptString(true); node = parsed.ParseModule(prettied); node.Should().NotBeNull(); }
Expected behavior It should generate valid JS after prettifying.
Might be same root cause as https://github.com/sebastienros/esprima-dotnet/pull/413, but wanted to just file it anyway in case it's not :)
Version used
3.0.1
Describe the bug The
ToJavascriptString
produces some odd code. It turns:into:
To Reproduce
Expected behavior It should generate valid JS after prettifying.