Skip to content

Commit 8760ef6

Browse files
authored
TypeScript: enable strict (#179)
1 parent a5e3d60 commit 8760ef6

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

src/Clause.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import { Context } from './Context';
1010
export default class Clause extends Builder {
1111
id: string;
1212
namespace: string;
13+
// @ts-ignore skipping the strictPropertyInitialization check
1314
header: HTMLHeadingElement;
1415
parentClause: Clause;
15-
title: string;
16+
title?: string;
17+
// @ts-ignore skipping the strictPropertyInitialization check
1618
titleHTML: string;
1719
subclauses: Clause[];
1820
number: string;

src/NonTerminal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default class NonTerminal extends Builder {
88
params: string | null;
99
optional: boolean;
1010
namespace: string;
11-
entry: BiblioEntry;
11+
entry?: BiblioEntry;
1212

1313
static elements = ['EMU-NT'];
1414

src/Note.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Context } from './Context';
66
/*@internal*/
77
export default class Note extends Builder {
88
clause: Clause;
9-
id: string;
9+
id?: string;
1010
type: string; // normal, editor
1111
static elements = ['EMU-NOTE'];
1212

src/RHS.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ export default class RHS extends Builder {
4141
const text = node.textContent!.trim();
4242
const pieces = text.split(/\s/);
4343

44-
pieces.forEach(function (p) {
44+
pieces.forEach(p => {
4545
if (p.length === 0) {
4646
return;
4747
}
4848
const est = this.spec.doc.createElement('emu-t');
4949
est.textContent = p;
5050

5151
parentNode.insertBefore(est, node);
52-
}, this);
52+
});
5353

5454
parentNode.removeChild(node);
5555
}

src/Spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ export default class Spec {
129129
table: 0,
130130
figure: 0
131131
};
132+
this._xrefs = [];
133+
this._ntRefs = [];
134+
this._prodRefs = [];
132135
this._textNodes = {};
133136

134137
this.processMetadata();
@@ -216,10 +219,6 @@ export default class Spec {
216219
currentId: null
217220
};
218221

219-
this._xrefs = [];
220-
this._ntRefs = [];
221-
this._prodRefs = [];
222-
223222
const document = this.doc;
224223
const walker = document.createTreeWalker(document.body, 1 | 4 /* elements and text nodes */);
225224

src/tsconfig.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"target": "es6",
44
"module": "commonjs",
55
"moduleResolution": "node",
6-
"strictNullChecks": true,
7-
"noImplicitAny": true,
6+
"strict": true,
87
"declaration": true,
98
"stripInternal": true,
109
"outDir": "../lib",
@@ -13,4 +12,4 @@
1312
"../node_modules/@types"
1413
]
1514
}
16-
}
15+
}

0 commit comments

Comments
 (0)