diff --git a/src/export/packer/next-compiler.spec.ts b/src/export/packer/next-compiler.spec.ts index c31a8c4ce7..1c1a867a12 100644 --- a/src/export/packer/next-compiler.spec.ts +++ b/src/export/packer/next-compiler.spec.ts @@ -111,7 +111,7 @@ describe("Compiler", () => { const spy = sinon.spy(compiler["formatter"], "format"); compiler.compile(file); - expect(spy.callCount).to.equal(12); + expect(spy.callCount).to.equal(13); }); it("should work with media datas", () => { diff --git a/src/export/packer/next-compiler.ts b/src/export/packer/next-compiler.ts index 59776fe1c4..3179af9a2e 100644 --- a/src/export/packer/next-compiler.ts +++ b/src/export/packer/next-compiler.ts @@ -406,26 +406,19 @@ export class Compiler { path: "word/settings.xml", }, Comments: { - data: (() => { - if (!file.Comments) { - return; - } - - const data = xml( - this.formatter.format(file.Comments, { - viewWrapper: file.Document, - file, - }), - { - indent: prettify, - declaration: { - standalone: "yes", - encoding: "UTF-8", - }, + data: xml( + this.formatter.format(file.Comments, { + viewWrapper: file.Document, + file, + }), + { + indent: prettify, + declaration: { + standalone: "yes", + encoding: "UTF-8", }, - ); - return data; - })(), + }, + ), path: "word/comments.xml", }, }; diff --git a/src/file/file.ts b/src/file/file.ts index afd13e5b6f..b640ba9b33 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -71,10 +71,7 @@ export class File { }, ); - if (options.comments) { - this.comments = new Comments(options.comments); - } - + this.comments = new Comments(options.comments ?? { children: [] }); this.fileRelationships = new Relationships(); this.customProperties = new CustomProperties(options.customProperties ?? []); this.appProperties = new AppProperties();