Skip to content

Commit a5a72dc

Browse files
committed
feat(global): improve assert type
1 parent 21cbeed commit a5a72dc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/global.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ declare const _G: Record<string, any>;
2525
* Calls error if the value of its argument v is false (i.e., nil or false); otherwise, returns all its arguments. In case of error, message is the error object; when absent, it defaults to "assertion failed!"
2626
* @tupleReturn
2727
*/
28-
declare function assert<T>(v: T, message?: string): Exclude<T, false | null | undefined>;
28+
declare function assert<T extends any[]>(
29+
...args: T
30+
): { [P in keyof T]: P extends '0' ? Exclude<T[P], false | null | undefined> : T[P] };
2931

3032
/**
3133
* This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt.
@@ -92,7 +94,6 @@ declare function getmetatable<T extends object>(object: T): LuaMetatable<T> | un
9294
* `for i,v in ipairs(t) do body end`
9395
*
9496
* will iterate over the key–value pairs (1,t[1]), (2,t[2]), ..., up to the first nil value.
95-
* @tupleReturn
9697
*/
9798
declare function ipairs<T>(t: Record<number, T>): LuaTupleIterable<[number, T]>;
9899

@@ -115,7 +116,6 @@ declare function next(table: object, index?: any): [any, any] | [];
115116
* will iterate over all key–value pairs of table t.
116117
*
117118
* See function next for the caveats of modifying the table during its traversal.
118-
* @tupleReturn
119119
*/
120120
declare function pairs<T>(t: T): LuaTupleIterable<[keyof T, T[keyof T]]>;
121121

0 commit comments

Comments
 (0)