magicast icon indicating copy to clipboard operation
magicast copied to clipboard

Inner comment lost when manipulating an object

Open Andarist opened this issue 2 years ago • 0 comments

Environment

[email protected]

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

Andarist avatar Apr 05 '23 11:04 Andarist