Describe the bug
Version: 10.1.0
I want to generate .ts file with variable content, that depend on my existedObject
Writers generate incorrect object representation
To Reproduce
import { Project, VariableDeclarationKind, Writers } from "ts-morph";
const project = new Project();
const sourceFile = project.createSourceFile("test.ts", ``);
const existedObject = {
id: "some-id",
"quote-key": 2
}
sourceFile.addVariableStatement({
isExported: true,
declarationKind: VariableDeclarationKind.Const,
declarations: [{
name: 'flavor',
initializer: Writers.object(existedObject),
}]
})
console.log(sourceFile.getFullText())
Output:
export const flavor = {
id: some-id,
quote-key: 2
};
Expected behavior
export const flavor = {
id: "some-id",
"quote-key": 2
};