Skip to content

Commit 0370365

Browse files
laughedelicaminya
andcommitted
refactor: adjust custom request types
Co-authored-by: Amin Yahyaabadi <[email protected]>
1 parent 008a9da commit 0370365

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/languageclient.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface KnownNotifications {
1717
export interface KnownRequests {
1818
"window/showMessageRequest": [lsp.ShowMessageRequestParams, lsp.MessageActionItem | null]
1919
"workspace/applyEdit": [lsp.ApplyWorkspaceEditParams, lsp.ApplyWorkspaceEditResponse]
20-
[custom: string]: [object, object | null]
20+
[custom: string]: [Record<string, any>, Record<string, any> | null]
2121
}
2222

2323
export type RequestCallback<T extends keyof KnownRequests> = KnownRequests[T] extends [infer U, infer V]
@@ -116,7 +116,10 @@ export class LanguageClientConnection extends EventEmitter {
116116
* @param callback The function to be called when the message is received.
117117
* The payload from the message is passed to the function.
118118
*/
119-
public onCustomRequest(method: string, callback: (obj: object) => Promise<object>): void {
119+
public onCustomRequest(
120+
method: string,
121+
callback: (obj: Record<string, any>) => Promise<Record<string, any> | null>
122+
): void {
120123
this._onRequest({ method }, callback)
121124
}
122125

0 commit comments

Comments
 (0)