Skip to content

Commit 9f44166

Browse files
authored
fix(api): executeLua return type is too narrow #353
fix #346
1 parent f89d1c9 commit 9f44166

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/neovim/src/api/Neovim.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('Neovim API', () => {
8686

8787
it('can run lua', async () => {
8888
expect(
89-
await nvim.lua('function test(a) return a end return test(...)', 1)
89+
await nvim.lua('function test(a) return a end return test(...)', [1])
9090
).toBe(1);
9191

9292
expect(

packages/neovim/src/api/Neovim.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,17 +448,17 @@ export class Neovim extends BaseApi {
448448
}
449449

450450
/**
451-
* Executes lua, it's possible neovim client does not support this
451+
* Executes Lua code.
452452
*/
453-
lua(code: string, args: VimValue[] = []): Promise<object> {
453+
lua(code: string, args: VimValue[] = []): Promise<VimValue> {
454454
const _args = Array.isArray(args) ? args : [args];
455455
return this.request(`${this.prefix}execute_lua`, [code, _args]);
456456
}
457457

458458
/**
459459
* Alias for `lua()` to be consistent with neovim API
460460
*/
461-
executeLua(code: string, args: VimValue[] = []): Promise<object> {
461+
executeLua(code: string, args: VimValue[] = []): ReturnType<typeof this.lua> {
462462
return this.lua(code, args);
463463
}
464464

0 commit comments

Comments
 (0)