From 97101adb10a6d0ae7d594c18a8cf077d995eb211 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 7 Jul 2017 14:31:08 +0100 Subject: [PATCH] Enabled declarations in tsconfig to be true --- ts/docx/document/document-attributes.ts | 2 +- ts/docx/paragraph/alignment.ts | 6 +++--- ts/docx/paragraph/tab-stop.ts | 10 +++++----- ts/docx/run/script.ts | 2 +- ts/docx/run/underline.ts | 2 +- ts/docx/table/index.ts | 12 ++++++------ ts/docx/table/properties.ts | 14 +++++++------- ts/docx/xml-components/attributes.ts | 2 +- ts/docx/xml-components/default-attributes.ts | 2 +- ts/numbering/level.ts | 2 +- ts/numbering/num.ts | 2 +- ts/properties/components.ts | 2 +- ts/properties/index.ts | 2 +- ts/relationships/attributes.ts | 2 +- ts/styles/latent-styles/exceptions.ts | 4 ++-- ts/tsconfig.json | 3 ++- 16 files changed, 35 insertions(+), 34 deletions(-) diff --git a/ts/docx/document/document-attributes.ts b/ts/docx/document/document-attributes.ts index bdd3dff089..88031719e9 100644 --- a/ts/docx/document/document-attributes.ts +++ b/ts/docx/document/document-attributes.ts @@ -1,6 +1,6 @@ import { XmlAttributeComponent } from "../xml-components"; -interface IDocumentAttributesProperties { +export interface IDocumentAttributesProperties { wpc?: string; mc?: string; o?: string; diff --git a/ts/docx/paragraph/alignment.ts b/ts/docx/paragraph/alignment.ts index 94e0568515..c019d8a546 100644 --- a/ts/docx/paragraph/alignment.ts +++ b/ts/docx/paragraph/alignment.ts @@ -1,14 +1,14 @@ import { XmlAttributeComponent, XmlComponent } from "../xml-components"; -type alignmentOptions = "left" | "center" | "right" | "both"; +export type AlignmentOptions = "left" | "center" | "right" | "both"; -class AlignmentAttributes extends XmlAttributeComponent<{val: alignmentOptions}> { +export class AlignmentAttributes extends XmlAttributeComponent<{val: AlignmentOptions}> { protected xmlKeys = {val: "w:val"}; } export class Alignment extends XmlComponent { - constructor(type: alignmentOptions) { + constructor(type: AlignmentOptions) { super("w:jc"); this.root.push(new AlignmentAttributes({val: type})); } diff --git a/ts/docx/paragraph/tab-stop.ts b/ts/docx/paragraph/tab-stop.ts index 6154c33d2a..36c4c088a5 100644 --- a/ts/docx/paragraph/tab-stop.ts +++ b/ts/docx/paragraph/tab-stop.ts @@ -1,6 +1,6 @@ import { XmlAttributeComponent, XmlComponent } from "../xml-components"; -class TabStop extends XmlComponent { +export class TabStop extends XmlComponent { constructor(tab: Tab) { super("w:tabs"); @@ -8,15 +8,15 @@ class TabStop extends XmlComponent { } } -export type tabOptions = "left" | "right"; +export type TabOptions = "left" | "right"; -class TabAttributes extends XmlAttributeComponent<{val: tabOptions, pos: string | number}> { +export class TabAttributes extends XmlAttributeComponent<{val: TabOptions, pos: string | number}> { protected xmlKeys = {val: "w:val", pos: "w:pos"}; } -class Tab extends XmlComponent { +export class Tab extends XmlComponent { - constructor(value: tabOptions, position: string | number) { + constructor(value: TabOptions, position: string | number) { super("w:tab"); this.root.push(new TabAttributes({ val: value, diff --git a/ts/docx/run/script.ts b/ts/docx/run/script.ts index 86d328c8ae..a39841709a 100644 --- a/ts/docx/run/script.ts +++ b/ts/docx/run/script.ts @@ -1,6 +1,6 @@ import { Attributes, XmlComponent } from "../xml-components"; -abstract class VerticalAlign extends XmlComponent { +export abstract class VerticalAlign extends XmlComponent { constructor(type: string) { super("w:vertAlign"); diff --git a/ts/docx/run/underline.ts b/ts/docx/run/underline.ts index 1a6fda2334..096f72d29f 100644 --- a/ts/docx/run/underline.ts +++ b/ts/docx/run/underline.ts @@ -1,6 +1,6 @@ import { Attributes, XmlComponent } from "../xml-components"; -abstract class BaseUnderline extends XmlComponent { +export abstract class BaseUnderline extends XmlComponent { constructor(underlineType: string, color?: string) { super("w:u"); diff --git a/ts/docx/table/index.ts b/ts/docx/table/index.ts index 82d5689709..66a6631533 100644 --- a/ts/docx/table/index.ts +++ b/ts/docx/table/index.ts @@ -2,7 +2,7 @@ import { Paragraph } from "../paragraph"; import { XmlComponent } from "../xml-components"; import { TableGrid } from "./grid"; -import { TableProperties, widthTypes } from "./properties"; +import { TableProperties, WidthTypes } from "./properties"; export class Table extends XmlComponent { private properties: TableProperties; @@ -51,7 +51,7 @@ export class Table extends XmlComponent { return this.getRow(row).getCell(col); } - public setWidth(type: widthTypes, width: number | string): Table { + public setWidth(type: WidthTypes, width: number | string): Table { this.properties.setWidth(type, width); return this; } @@ -62,7 +62,7 @@ export class Table extends XmlComponent { } } -class TableRow extends XmlComponent { +export class TableRow extends XmlComponent { private properties: TableRowProperties; private cells: TableCell[]; @@ -79,13 +79,13 @@ class TableRow extends XmlComponent { } } -class TableRowProperties extends XmlComponent { +export class TableRowProperties extends XmlComponent { constructor() { super("w:trPr"); } } -class TableCell extends XmlComponent { +export class TableCell extends XmlComponent { private properties: TableCellProperties; constructor() { @@ -116,7 +116,7 @@ class TableCell extends XmlComponent { } } -class TableCellProperties extends XmlComponent { +export class TableCellProperties extends XmlComponent { constructor() { super("w:tcPr"); } diff --git a/ts/docx/table/properties.ts b/ts/docx/table/properties.ts index ab487e58fb..09ced45d00 100644 --- a/ts/docx/table/properties.ts +++ b/ts/docx/table/properties.ts @@ -1,13 +1,13 @@ import { XmlAttributeComponent, XmlComponent } from "../xml-components"; -export type widthTypes = "dxa" | "pct" | "nil" | "auto"; +export type WidthTypes = "dxa" | "pct" | "nil" | "auto"; export class TableProperties extends XmlComponent { constructor() { super("w:tblPr"); } - public setWidth(type: widthTypes, w: number | string): TableProperties { + public setWidth(type: WidthTypes, w: number | string): TableProperties { this.root.push(new PreferredTableWidth(type, w)); return this; } @@ -19,7 +19,7 @@ export class TableProperties extends XmlComponent { } interface ITableWidth { - type: widthTypes; + type: WidthTypes; w: number | string; } @@ -28,20 +28,20 @@ class TableWidthAttributes extends XmlAttributeComponent { } class PreferredTableWidth extends XmlComponent { - constructor(type: widthTypes, w: number | string) { + constructor(type: WidthTypes, w: number | string) { super("w:tblW"); this.root.push(new TableWidthAttributes({type, w})); } } -type tableLayout = "autofit" | "fixed"; +type TableLayoutOptions = "autofit" | "fixed"; -class TableLayoutAttributes extends XmlAttributeComponent<{type: tableLayout}> { +class TableLayoutAttributes extends XmlAttributeComponent<{type: TableLayoutOptions}> { protected xmlKeys = {type: "w:type"}; } class TableLayout extends XmlComponent { - constructor(type: tableLayout) { + constructor(type: TableLayoutOptions) { super("w:tblLayout"); this.root.push(new TableLayoutAttributes({type})); } diff --git a/ts/docx/xml-components/attributes.ts b/ts/docx/xml-components/attributes.ts index 33cbbc1f7b..b7813cb11a 100644 --- a/ts/docx/xml-components/attributes.ts +++ b/ts/docx/xml-components/attributes.ts @@ -1,6 +1,6 @@ import { XmlAttributeComponent } from "./default-attributes"; -interface IAttributesProperties { +export interface IAttributesProperties { val?: string | number | boolean; color?: string; space?: string; diff --git a/ts/docx/xml-components/default-attributes.ts b/ts/docx/xml-components/default-attributes.ts index e3eba50809..a09a0845a0 100644 --- a/ts/docx/xml-components/default-attributes.ts +++ b/ts/docx/xml-components/default-attributes.ts @@ -1,6 +1,6 @@ import { BaseXmlComponent } from "./base"; -type AttributeMap = {[P in keyof T]: string}; +export type AttributeMap = {[P in keyof T]: string}; export abstract class XmlAttributeComponent extends BaseXmlComponent { protected root: T; diff --git a/ts/numbering/level.ts b/ts/numbering/level.ts index f70cb8db56..cafeebd6d4 100644 --- a/ts/numbering/level.ts +++ b/ts/numbering/level.ts @@ -56,7 +56,7 @@ class LevelJc extends XmlComponent { } } -class LevelBase extends XmlComponent { +export class LevelBase extends XmlComponent { private paragraphProperties: ParagraphProperties; private runProperties: RunProperties; diff --git a/ts/numbering/num.ts b/ts/numbering/num.ts index 8bdd6e9adc..5e73441f8d 100644 --- a/ts/numbering/num.ts +++ b/ts/numbering/num.ts @@ -42,7 +42,7 @@ class LevelOverrideAttributes extends XmlAttributeComponent<{ilvl: number}> { protected xmlKeys = {ilvl: "w:ilvl"}; } -class LevelOverride extends XmlComponent { +export class LevelOverride extends XmlComponent { private levelNum: number; private lvl?: LevelForOverride; diff --git a/ts/properties/components.ts b/ts/properties/components.ts index d5e1b7fc01..387524a35b 100644 --- a/ts/properties/components.ts +++ b/ts/properties/components.ts @@ -57,7 +57,7 @@ export class Revision extends XmlComponent { } } -abstract class DateComponent extends XmlComponent { +export abstract class DateComponent extends XmlComponent { protected getCurrentDate(): string { const date = new Date(); const year = date.getFullYear(); diff --git a/ts/properties/index.ts b/ts/properties/index.ts index 22067d1caa..943a620677 100644 --- a/ts/properties/index.ts +++ b/ts/properties/index.ts @@ -2,7 +2,7 @@ import { DocumentAttributes } from "../docx/document/document-attributes"; import { XmlComponent } from "../docx/xml-components"; import { Created, Creator, Description, Keywords, LastModifiedBy, Modified, Revision, Subject, Title } from "./components"; -interface IPropertiesOptions { +export interface IPropertiesOptions { title?: string; subject?: string; creator?: string; diff --git a/ts/relationships/attributes.ts b/ts/relationships/attributes.ts index 4aae08248d..14d88b7a96 100644 --- a/ts/relationships/attributes.ts +++ b/ts/relationships/attributes.ts @@ -1,6 +1,6 @@ import { XmlAttributeComponent } from "../docx/xml-components"; -interface IRelationshipsAttributesProperties { +export interface IRelationshipsAttributesProperties { xmlns: string; } diff --git a/ts/styles/latent-styles/exceptions.ts b/ts/styles/latent-styles/exceptions.ts index 83995b0902..ceaf5477fe 100644 --- a/ts/styles/latent-styles/exceptions.ts +++ b/ts/styles/latent-styles/exceptions.ts @@ -1,6 +1,6 @@ import { XmlAttributeComponent, XmlComponent } from "../../docx/xml-components"; -interface ILatentStyleExceptionAttributesProperties { +export interface ILatentStyleExceptionAttributesProperties { name?: string; uiPriority?: string; qFormat?: string; @@ -8,7 +8,7 @@ interface ILatentStyleExceptionAttributesProperties { unhideWhenUsed?: string; } -class LatentStyleExceptionAttributes extends XmlAttributeComponent { +export class LatentStyleExceptionAttributes extends XmlAttributeComponent { protected xmlKeys = { name: "w:name", uiPriority: "w:uiPriority", diff --git a/ts/tsconfig.json b/ts/tsconfig.json index 7ae95adc9e..bdb1db6489 100644 --- a/ts/tsconfig.json +++ b/ts/tsconfig.json @@ -8,7 +8,8 @@ "outDir": "../build", "sourceRoot": "./", "rootDir": "./", - "module": "commonjs" + "module": "commonjs", + "declaration": true }, "exclude": [ "tests"