Skip to content

Commit 9f985d8

Browse files
committed
fix: pairs and next functions have invalid key type
1 parent 96bb9a6 commit 9f985d8

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

core/global.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ declare function ipairs<T extends object>(t: T): [(t: T, index?: number) => [num
9090
* The behavior of next is undefined if, during the traversal, you assign any value to a non-existent field in the table. You may however modify existing fields. In particular, you may clear existing fields.
9191
* @tupleReturn
9292
*/
93-
declare function next(table: object, index?: keyof any): [keyof any, any] | [];
93+
declare function next(table: object, index?: any): [any, any] | [];
9494

9595
/**
9696
* If t has a metamethod __pairs, calls it with t as argument and returns the first three results from the call.
@@ -103,7 +103,7 @@ declare function next(table: object, index?: keyof any): [keyof any, any] | [];
103103
* See function next for the caveats of modifying the table during its traversal.
104104
* @tupleReturn
105105
*/
106-
declare function pairs<T>(t: T): [(t: T, index?: keyof any) => [keyof any, any], T];
106+
declare function pairs<T>(t: T): [(t: T, index?: any) => [any, any], T];
107107

108108
/**
109109
* Calls function f with the given arguments in protected mode. This means that any error inside f is not propagated; instead, pcall catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error message.

special/5.2-plus.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ interface LuaMetatable<T> {
9494
/**
9595
* Handle iteration through table pairs when `for k,v in pairs(tbl) do ... end` is called.
9696
*/
97-
__pairs<T>(t: T): [(t: T, index?: keyof any) => [keyof any, any], T];
97+
__pairs<T>(t: T): [(t: T, index?: any) => [any, any], T];
9898

9999
/**
100100
* Handle iteration through table pairs when `for k,v in ipairs(tbl) do ... end` is called.

0 commit comments

Comments
 (0)