Archived
1
0

Remove <type> from onMessage

Turns out that while Typescript can't infer the callback return type
from it, Typescript can do the opposite and infer it from the callback
return type.
This commit is contained in:
Asher 2020-11-12 11:17:45 -06:00
parent 72931edcf0
commit 31b67062b0
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -69,7 +69,7 @@ export class VscodeProvider {
vscode,
)
const message = await this.onMessage<ipc.OptionsMessage>(vscode, (message): message is ipc.OptionsMessage => {
const message = await this.onMessage(vscode, (message): message is ipc.OptionsMessage => {
// There can be parallel initializations so wait for the right ID.
return message.type === "options" && message.id === id
})
@ -104,7 +104,7 @@ export class VscodeProvider {
dispose()
})
this._vscode = this.onMessage<ipc.ReadyMessage>(vscode, (message): message is ipc.ReadyMessage => {
this._vscode = this.onMessage(vscode, (message): message is ipc.ReadyMessage => {
return message.type === "ready"
}).then(() => vscode)