Use .?method() in more places (#152112)

Switches simple patterns like:

```ts
if (some.thing) {
    some.thing.method();
}
```

to:

```ts
some.thing?.method()
```

This is more concise and avoids having to repeat the `some.thing` part
This commit is contained in:
Matt Bierner
2022-06-15 09:28:31 -07:00
committed by GitHub
parent 6d379ac730
commit f17b33faf2
122 changed files with 179 additions and 529 deletions

View File

@@ -86,15 +86,11 @@ class WebWorker implements IWorker {
}
public postMessage(message: any, transfer: Transferable[]): void {
if (this.worker) {
this.worker.then(w => w.postMessage(message, transfer));
}
this.worker?.then(w => w.postMessage(message, transfer));
}
public dispose(): void {
if (this.worker) {
this.worker.then(w => w.terminate());
}
this.worker?.then(w => w.terminate());
this.worker = null;
}
}