Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional semicolon it TSInterfaceBody #867

Closed
coderaiser opened this issue Feb 23, 2021 · 0 comments · Fixed by #868
Closed

Additional semicolon it TSInterfaceBody #867

coderaiser opened this issue Feb 23, 2021 · 0 comments · Fixed by #868

Comments

@coderaiser
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant