mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Do not incorrectly add line separators for non-synthetic nodes when emitting node list (#44070)
As of 3c32f6e154, a line separator is
added between nodes if the nodes are not synthetic and on separate
lines. This it push s wrong and previously only happened if the non-synthetic
nodes were on different lines but had the same parent.
Fixes #44068.
This commit is contained in:
@@ -154,6 +154,26 @@ namespace ts {
|
||||
}).outputText;
|
||||
});
|
||||
|
||||
testBaseline("issue44068", () => {
|
||||
return transformSourceFile(`
|
||||
const FirstVar = null;
|
||||
const SecondVar = null;
|
||||
`, [
|
||||
context => file => {
|
||||
const firstVarName = (file.statements[0] as VariableStatement)
|
||||
.declarationList.declarations[0].name as Identifier;
|
||||
const secondVarName = (file.statements[0] as VariableStatement)
|
||||
.declarationList.declarations[0].name as Identifier;
|
||||
|
||||
return context.factory.updateSourceFile(file, file.statements.concat([
|
||||
context.factory.createExpressionStatement(
|
||||
context.factory.createArrayLiteralExpression([firstVarName, secondVarName])
|
||||
),
|
||||
]));
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
testBaseline("rewrittenNamespace", () => {
|
||||
return transpileModule(`namespace Reflect { const x = 1; }`, {
|
||||
transformers: {
|
||||
|
||||
Reference in New Issue
Block a user