diff --git a/test/typescript.ts b/test/typescript.ts index 1480a24e..48e14513 100644 --- a/test/typescript.ts +++ b/test/typescript.ts @@ -365,6 +365,25 @@ const nodeMajorVersion = parseInt(process.versions.node, 10); ].join(eol), ); }); + + it("TypeLiteral: unwanted commma", function () { + const code = [ + "type A = {", + " x: boolean;", + " y: number;", + " z: string;", + "}", + ].join(eol); + + const ast = recast.parse(code, { parser }); + + ast.program.body[0].typeAnnotation.members.pop(); + + assert.strictEqual( + recast.print(ast).code, + ["type A = {", " x: boolean;", " y: number;", "}"].join(eol), + ); + }); }); testReprinting(