magicast
magicast copied to clipboard
Inner comment lost when manipulating an object
Environment
Reproduction
import { parseModule, generateCode } from "magicast";
const mod = parseModule(`
export default {
/*inner comment*/
}
`);
mod.exports.default.foo ||= [];
mod.exports.default.foo.push("b");
mod.exports.default.foo.unshift("a");
const { code } = generateCode(mod);
console.log({ code });
Describe the bug
actual: an inner comment within an empty object is lost after manipulating that object expected: the inner comment should be preserved
Additional context
No response
Logs
No response