Skip to content

Commit

Permalink
add would-be failing test for unwanted commas in TSTypeLiteral
Browse files Browse the repository at this point in the history
  • Loading branch information
henryqdineen committed Jul 30, 2022
1 parent 82c527c commit 5c660cf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,25 @@ const nodeMajorVersion = parseInt(process.versions.node, 10);
].join(eol),
);
});

it("TypeLiteral: unwanted comma", 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(
Expand Down

0 comments on commit 5c660cf

Please sign in to comment.