diff --git a/ts/docx/table/index.ts b/ts/docx/table/index.ts index 66a6631533..9969926fb7 100644 --- a/ts/docx/table/index.ts +++ b/ts/docx/table/index.ts @@ -1,6 +1,6 @@ import { Paragraph } from "../paragraph"; import { XmlComponent } from "../xml-components"; - +import { IXmlableObject } from "../xml-components/xmlable-object"; import { TableGrid } from "./grid"; import { TableProperties, WidthTypes } from "./properties"; @@ -99,7 +99,7 @@ export class TableCell extends XmlComponent { return this; } - public prepForXml(): XmlableObject { + public prepForXml(): IXmlableObject { // Cells must end with a paragraph const retval = super.prepForXml(); const content = retval["w:tc"]; diff --git a/ts/docx/xml-components/base.ts b/ts/docx/xml-components/base.ts index 82061d9a41..d634a418a9 100644 --- a/ts/docx/xml-components/base.ts +++ b/ts/docx/xml-components/base.ts @@ -1,3 +1,5 @@ +import { IXmlableObject } from "./xmlable-object"; + export abstract class BaseXmlComponent { protected rootKey: string; @@ -5,5 +7,5 @@ export abstract class BaseXmlComponent { this.rootKey = rootKey; } - public abstract prepForXml(): XmlableObject; + public abstract prepForXml(): IXmlableObject; } diff --git a/ts/docx/xml-components/default-attributes.ts b/ts/docx/xml-components/default-attributes.ts index a09a0845a0..60b58f330f 100644 --- a/ts/docx/xml-components/default-attributes.ts +++ b/ts/docx/xml-components/default-attributes.ts @@ -1,4 +1,5 @@ import { BaseXmlComponent } from "./base"; +import { IXmlableObject } from "./xmlable-object"; export type AttributeMap = {[P in keyof T]: string}; @@ -11,7 +12,7 @@ export abstract class XmlAttributeComponent extends BaseXmlComponent { this.root = properties; } - public prepForXml(): XmlableObject { + public prepForXml(): IXmlableObject { const attrs = {}; Object.keys(this.root).forEach((key) => { const value = this.root[key]; diff --git a/ts/docx/xml-components/index.ts b/ts/docx/xml-components/index.ts index aedcbcedb4..93756514be 100644 --- a/ts/docx/xml-components/index.ts +++ b/ts/docx/xml-components/index.ts @@ -1,4 +1,5 @@ import { BaseXmlComponent } from "./base"; +import { IXmlableObject } from "./xmlable-object"; export { BaseXmlComponent }; export abstract class XmlComponent extends BaseXmlComponent { @@ -9,7 +10,7 @@ export abstract class XmlComponent extends BaseXmlComponent { this.root = new Array(); } - public prepForXml(): XmlableObject { + public prepForXml(): IXmlableObject { const children = this.root.map((comp) => { if (comp instanceof BaseXmlComponent) { return comp.prepForXml(); diff --git a/ts/docx/xml-components/xmlable-object.d.ts b/ts/docx/xml-components/xmlable-object.d.ts deleted file mode 100644 index 517fd0b332..0000000000 --- a/ts/docx/xml-components/xmlable-object.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare interface XmlableObject extends Object { - _attr?: { [key: string]: (string | number | boolean) } -} diff --git a/ts/docx/xml-components/xmlable-object.ts b/ts/docx/xml-components/xmlable-object.ts new file mode 100644 index 0000000000..b180cab89d --- /dev/null +++ b/ts/docx/xml-components/xmlable-object.ts @@ -0,0 +1,3 @@ +export interface IXmlableObject extends Object { + _attr?: { [key: string]: (string | number | boolean) }; +} diff --git a/ts/export/formatter.ts b/ts/export/formatter.ts index 36b0587240..fe8d142c31 100644 --- a/ts/export/formatter.ts +++ b/ts/export/formatter.ts @@ -1,7 +1,8 @@ import { BaseXmlComponent } from "../docx/xml-components"; +import { IXmlableObject } from "../docx/xml-components/xmlable-object"; export class Formatter { - public format(input: BaseXmlComponent): XmlableObject { + public format(input: BaseXmlComponent): IXmlableObject { return input.prepForXml(); } }