Skip to content

Additional semicolon it TSInterfaceBody #867

Description

@coderaiser

When AST with TSInterfaceBody changed, it produced additional semicolon, which is not valid code:

const {print, parse} = require('recast');
const code = [
    "interface Hello {",
    "  'hello': any;",
    "  'hello': string;",
    "}",
].join(eol);
    
const ast = recast.parse(code, {
    parser: require('recast/parser/typescript'),
});
    
ast.program.body[0].body.body.pop();
recast.print(ast).code;
// returns
"interface Hello {",
"  'hello': any;;",
"}",

Also I want to mention that recast.prettyPrint not cover this case, so it's not tested with print.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions