File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -192,10 +192,17 @@ declare namespace debug {
192192 * Sets the metatable for the given value to the given table (which can be
193193 * nil). Returns value.
194194 */
195- function setmetatable < T , TIndex > (
195+ function setmetatable <
196+ T extends object ,
197+ TIndex extends object | ( ( this : T , key : any ) => any ) | undefined = undefined
198+ > (
196199 value : T ,
197- table : LuaMetatable < T & TIndex , TIndex > | null | undefined
198- ) : T & TIndex ;
200+ table ?: LuaMetatable < T , TIndex > | null
201+ ) : TIndex extends ( this : T , key : infer TKey ) => infer TValue
202+ ? T & { [ K in TKey & string ] : TValue }
203+ : TIndex extends object
204+ ? T & TIndex
205+ : T ;
199206
200207 /**
201208 * This function assigns the value value to the upvalue with index up of the
Original file line number Diff line number Diff line change 11// Based on https://www.lua.org/manual/5.3/manual.html#2.4
22
3- interface LuaMetatable < T , TIndex extends object | ( ( this : T , key : any ) => any ) | undefined > {
3+ interface LuaMetatable <
4+ T ,
5+ TIndex extends object | ( ( this : T , key : any ) => any ) | undefined =
6+ | object
7+ | ( ( this : T , key : any ) => any )
8+ | undefined
9+ > {
410 /**
511 * the addition (+) operation. If any operand for an addition is not a number
612 * (nor a string coercible to a number), Lua will try to call a metamethod.
You can’t perform that action at this time.
0 commit comments