🐛 Formatter inserts syntax errors in TypeScript import()
types since 1.9.4
#4421
Labels
S-Needs triage
Status: this issue needs to be triaged
Environment information
What happened?
The JS import statement (JsImportCallExpression) allows a trailing comma after the import path, the typescript import statement (TsImportType) does not.
Since 1.9.4, the formatter will insert trailing commas after long import paths, causing syntax errors.
It was likely introduced here: #3462.
Playground link: https://biomejs.dev/playground/?code=LwAvACAAbwBrACAALQAgAHQAcgBhAGkAbABpAG4AZwAgAGMAbwBtAG0AYQAgAGkAcwAgAGEAbABsAG8AdwBlAGQAIABoAGUAcgBlAAoAYwBvAG4AcwB0ACAAYQAgAD0AIABpAG0AcABvAHIAdAAoACIALgAvAHAAYQB0AGgAIgAsACkALgBkAGUAZgBhAHUAbAB0AAoACgAvAC8AIABpAG4AYwBvAHIAcgBlAGMAdAAgAC0AIAB0AHIAYQBpAGwAaQBuAGcAIABjAG8AbQBtAGEAIABoAGUAcgBlACAAcwBoAG8AdQBsAGQAIABiAGUAIABhACAAcwB5AG4AdABhAHgAIABlAHIAcgBvAHIACgB0AHkAcABlACAAYgAgAD0AIAB0AHkAcABlAG8AZgAgAGkAbQBwAG8AcgB0ACgAIgAuAC8AcABhAHQAaAAiACwAKQAuAGQAZQBmAGEAdQBsAHQACgAKAC8ALwAgAGkAbgBjAG8AcgByAGUAYwB0ACAALQAgAGYAbwByAG0AYQB0AHQAZQByACAAaQBuAHMAZQByAHQAcwAgAGEAIABzAHkAbgB0AGEAeAAgAGUAcgByAG8AcgAKAHQAeQBwAGUAIABjACAAPQAgAHQAeQBwAGUAbwBmACAAaQBtAHAAbwByAHQAKAAiAC4ALwBsAG8AbgBnAC8AbABvAG4AZwAvAGwAbwBuAGcALwBsAG8AbgBnAC8AbABvAG4AZwAvAGwAbwBuAGcALwBsAG8AbgBnAC8AbABvAG4AZwAvAHAAYQB0AGgALwBsAG8AbgBnAC8AbABvAG4AZwAvAGwAbwBuAGcALwBsAG8AbgBnAC8AcABhAHQAaAAiACkALgBkAGUAZgBhAHUAbAB0AAoA
Expected result
Parsing the arguments as JsCallArgumentList is correct for JsImportCallExpression, but not for TsImportType. Typescript parses it completely differently, even though it looks the same.
Code of Conduct
The text was updated successfully, but these errors were encountered: