strict typescript checks

master
Jason Staten 6 years ago
parent dd585804c4
commit 1b9097fc70

@ -70,7 +70,7 @@ const ensureArray = (source: any) =>
class JsonRpc { class JsonRpc {
private methods: Methods; private methods: Methods;
private destination?: JsonRpcDestination; private destination?: JsonRpcDestination;
private source: JsonRpcSource; private source?: JsonRpcSource;
private origin: string; private origin: string;
private sequence = 0; private sequence = 0;
private deferreds: DeferredLookup = {}; private deferreds: DeferredLookup = {};
@ -79,8 +79,10 @@ class JsonRpc {
this.methods = methods; this.methods = methods;
this.destination = destination; this.destination = destination;
this.origin = origin || '*'; this.origin = origin || '*';
if (source) { this.source = source;
this.mount(source);
if (this.source) {
this.mount(this.source);
} }
} }
@ -110,7 +112,8 @@ class JsonRpc {
} }
unmount() { unmount() {
this.source.removeEventListener('message', this.handleMessage); this.source &&
this.source.removeEventListener('message', this.handleMessage);
} }
private handleRequest(request: JsonRpcRequest): Promise<JsonRpcResponse> { private handleRequest(request: JsonRpcRequest): Promise<JsonRpcResponse> {

@ -1,8 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"declaration": true, "declaration": true,
"noImplicitAny": true, "strict": true,
"strictNullChecks": true, "strictFunctionTypes": false,
"target": "es5", "target": "es5",
"module": "esnext", "module": "esnext",
"lib": ["es5", "es2015", "es2016", "dom"] "lib": ["es5", "es2015", "es2016", "dom"]

Loading…
Cancel
Save