Skip to content

Commit 5c660cf

Browse files
committed
add would-be failing test for unwanted commas in TSTypeLiteral
1 parent 82c527c commit 5c660cf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/typescript.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,25 @@ const nodeMajorVersion = parseInt(process.versions.node, 10);
365365
].join(eol),
366366
);
367367
});
368+
369+
it("TypeLiteral: unwanted comma", function () {
370+
const code = [
371+
"type A = {",
372+
" x: boolean;",
373+
" y: number;",
374+
" z: string;",
375+
"}",
376+
].join(eol);
377+
378+
const ast = recast.parse(code, { parser });
379+
380+
ast.program.body[0].typeAnnotation.members.pop();
381+
382+
assert.strictEqual(
383+
recast.print(ast).code,
384+
["type A = {", " x: boolean;", " y: number;", "}"].join(eol),
385+
);
386+
});
368387
});
369388

370389
testReprinting(

0 commit comments

Comments
 (0)