fix a handful of strict null errors; make test config also be strict
These errors only arose because I didn't run `npm build`, only `npm test`. Then, when I tried building the null checks failed. Keeping the two config fiels in sync will help prevent this issue in the future
This commit is contained in:
@ -14,6 +14,8 @@ class GridColAttributes extends XmlAttributeComponent<{w: number}> {
|
|||||||
export class GridCol extends XmlComponent {
|
export class GridCol extends XmlComponent {
|
||||||
constructor(width?: number) {
|
constructor(width?: number) {
|
||||||
super("w:gridCol");
|
super("w:gridCol");
|
||||||
|
if (width !== undefined) {
|
||||||
this.root.push(new GridColAttributes({w: width}));
|
this.root.push(new GridColAttributes({w: width}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -23,7 +23,7 @@ export class Table extends XmlComponent {
|
|||||||
|
|
||||||
this.rows = [];
|
this.rows = [];
|
||||||
for (let i = 0; i < rows; i++) {
|
for (let i = 0; i < rows; i++) {
|
||||||
const cells = [];
|
const cells: TableCell[] = [];
|
||||||
for (let j = 0; j < cols; j++) {
|
for (let j = 0; j < cols; j++) {
|
||||||
cells.push(new TableCell());
|
cells.push(new TableCell());
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"removeComments": true,
|
||||||
|
"preserveConstEnums": true,
|
||||||
"outDir": "../build-tests",
|
"outDir": "../build-tests",
|
||||||
|
"sourceRoot": "./",
|
||||||
"rootDir": "./",
|
"rootDir": "./",
|
||||||
"module": "commonjs"
|
"module": "commonjs"
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,7 @@ describe("GridCol", () => {
|
|||||||
it("does not set a width attribute if not given", () => {
|
it("does not set a width attribute if not given", () => {
|
||||||
const grid = new GridCol();
|
const grid = new GridCol();
|
||||||
const tree = new Formatter().format(grid);
|
const tree = new Formatter().format(grid);
|
||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({"w:gridCol": []});
|
||||||
"w:gridCol": [{_attr: {}}],
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -35,13 +33,5 @@ describe("TableGrid", () => {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not set a width attribute if not given", () => {
|
|
||||||
const grid = new GridCol();
|
|
||||||
const tree = new Formatter().format(grid);
|
|
||||||
expect(tree).to.deep.equal({
|
|
||||||
"w:gridCol": [{_attr: {}}],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user