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.
When
ASTwithTSInterfaceBodychanged, it produced additional semicolon, which is not valid code:Also I want to mention that
recast.prettyPrintnot cover this case, so it's not tested withprint.