Skip to content

Commit df6e775

Browse files
committed
🐛 Fix Lambda.dispose() to return void instead of boolean
Previously, `Lambda.dispose()` returned a boolean value from `unregister()`, even though its type definition specifies a return type of `void`. This commit updates the implementation to ensure that `dispose()` and `[Symbol.dispose]` both return `void` as intended.
1 parent 5f8e7f4 commit df6e775

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lambda/mod.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ export function add(denops: Denops, fn: Fn): Lambda {
265265
};
266266
const id = register(denops, fnWrapper);
267267
const { name } = denops;
268+
const dispose = (): void => void unregister(denops, id);
268269
return {
269270
id,
270271
notify: (...args: unknown[]) => {
@@ -275,8 +276,8 @@ export function add(denops: Denops, fn: Fn): Lambda {
275276
const fnArgs: FnWrapperArgs = [VIM_REQUEST_FLAG, "request", args];
276277
return expr`eval(denops#request(${name}, ${id}, ${fnArgs}))`;
277278
},
278-
dispose: () => unregister(denops, id),
279-
[Symbol.dispose]: () => void unregister(denops, id),
279+
dispose,
280+
[Symbol.dispose]: dispose,
280281
};
281282
}
282283

0 commit comments

Comments
 (0)