TypeFox / vscode-messenger

RPC messaging library for the VS Code extension platform
MIT License
33 stars 3 forks source link

Improve type checking for notification and request types #14

Closed dhuebner closed 10 months ago

dhuebner commented 11 months ago

When using request and notification types the types are not properly checked. Example:

const Notification: NotificationType<string> = {
    method: 'note'
};

messenger
    .sendNotification<number>(Notification, { type: 'webview', webviewType: 'test' }, 5);

const Request: RequestType<string,string> = {
    method: 'req'
};

//  no error reported below, but should as Request parameter type was redefined from <string,string> to <number, number>.
const response = messenger.sendRequest<number, number>(Request, { type: 'webview', webviewType: 'test' }, 5);
dhuebner commented 10 months ago

Fixed with #15