Update Protocol type inference

This commit is contained in:
Justin Spahr-Summers 2024-10-02 15:55:22 +01:00
commit 42fbfe2ff4
No known key found for this signature in database
GPG key ID: E78498BF3C053CA7

View file

@ -1,11 +1,10 @@
import { Protocol } from "../shared/protocol.js";
import {
ClientCapabilities,
ClientNotification,
ClientRequest,
ClientResult,
Implementation,
InitializedNotificationSchema,
InitializeRequest,
InitializeRequestSchema,
InitializeResult,
PROTOCOL_VERSION,
ServerNotification,
@ -19,9 +18,6 @@ import {
* This server will automatically respond to the initialization flow as initiated from the client.
*/
export class Server extends Protocol<
ClientRequest,
ClientNotification,
ClientResult,
ServerRequest,
ServerNotification,
ServerResult
@ -40,10 +36,10 @@ export class Server extends Protocol<
constructor(private _serverInfo: Implementation) {
super();
this.setRequestHandler("initialize", (request) =>
this._oninitialize(request as InitializeRequest),
this.setRequestHandler(InitializeRequestSchema, (request) =>
this._oninitialize(request),
);
this.setNotificationHandler("notification/initialized", () =>
this.setNotificationHandler(InitializedNotificationSchema, () =>
this.oninitialized?.(),
);
}