Remove extra checks for non-nullable functions/properties (#94631)

TS 3.9 is smarter about catching cases where an if statement is always true. This revealed a few places in our codebase where we were checking to see if a function property exists before calling it, but the property is not nullable
This commit is contained in:
Matt Bierner
2020-04-13 16:07:29 -07:00
committed by GitHub
parent b6ee1ed7cf
commit 0e854e6e46
8 changed files with 16 additions and 38 deletions

View File

@@ -1072,11 +1072,9 @@ class DirectDebugAdapter extends AbstractDebugAdapter {
constructor(private implementation: vscode.DebugAdapter) {
super();
if (this.implementation.onDidSendMessage) {
implementation.onDidSendMessage((message: vscode.DebugProtocolMessage) => {
this.acceptMessage(message as DebugProtocol.ProtocolMessage);
});
}
implementation.onDidSendMessage((message: vscode.DebugProtocolMessage) => {
this.acceptMessage(message as DebugProtocol.ProtocolMessage);
});
}
startSession(): Promise<void> {
@@ -1084,15 +1082,11 @@ class DirectDebugAdapter extends AbstractDebugAdapter {
}
sendMessage(message: DebugProtocol.ProtocolMessage): void {
if (this.implementation.handleMessage) {
this.implementation.handleMessage(message);
}
this.implementation.handleMessage(message);
}
stopSession(): Promise<void> {
if (this.implementation.dispose) {
this.implementation.dispose();
}
this.implementation.dispose();
return Promise.resolve(undefined);
}
}