fix a couple of compiler null warnings

This commit is contained in:
felipe
2017-03-10 14:30:07 +01:00
parent 62911d6e44
commit a89718ea83
2 changed files with 11 additions and 8 deletions

View File

@ -1,8 +1,8 @@
import { XmlAttributeComponent, XmlComponent } from "../xml-components"; import { XmlAttributeComponent, XmlComponent } from "../xml-components";
interface IIndentAttributesProperties { interface IIndentAttributesProperties {
left: number; left?: number;
hanging: number; hanging?: number;
} }
class IndentAttributes extends XmlAttributeComponent<IIndentAttributesProperties> { class IndentAttributes extends XmlAttributeComponent<IIndentAttributesProperties> {

View File

@ -20,17 +20,18 @@ export abstract class Packer {
constructor(document: Document, style?: Styles, properties?: Properties, numbering?: Numbering) { constructor(document: Document, style?: Styles, properties?: Properties, numbering?: Numbering) {
this.formatter = new Formatter(); this.formatter = new Formatter();
this.document = document; this.document = document;
this.style = style;
this.properties = properties;
this.numbering = numbering;
this.archive = archiver.create("zip", {}); this.archive = archiver.create("zip", {});
if (!style) { if (style) {
this.style = style;
} else {
const stylesFactory = new DefaultStylesFactory(); const stylesFactory = new DefaultStylesFactory();
this.style = stylesFactory.newInstance(); this.style = stylesFactory.newInstance();
} }
if (!properties) { if (properties) {
this.properties = properties;
} else {
this.properties = new Properties({ this.properties = new Properties({
creator: "Un-named", creator: "Un-named",
revision: "1", revision: "1",
@ -38,7 +39,9 @@ export abstract class Packer {
}); });
} }
if (!numbering) { if (numbering) {
this.numbering = numbering;
} else {
this.numbering = new Numbering(); this.numbering = new Numbering();
} }