Skip to content

Commit 59f9cfa

Browse files
authored
Make pairs and ipairs return non-nullable values (#30)
* Make pairs and ipairs return non-nullable values * Fix prettier formatting Co-authored-by: Benjamin Ye <[email protected]>
1 parent 9f91ef4 commit 59f9cfa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/global.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ declare function getmetatable<T>(object: T): LuaMetatable<T> | undefined;
124124
* will iterate over the key–value pairs (1,t[1]), (2,t[2]), ..., up to the
125125
* first nil value.
126126
*/
127-
declare function ipairs<T>(t: Record<number, T>): LuaIterable<LuaMultiReturn<[number, T]>>;
127+
declare function ipairs<T>(
128+
t: Record<number, T>
129+
): LuaIterable<LuaMultiReturn<[number, NonNullable<T>]>>;
128130

129131
/**
130132
* Allows a program to traverse all fields of a table. Its first argument is a
@@ -160,7 +162,7 @@ declare function next(table: object, index?: any): LuaMultiReturn<[any, any] | [
160162
declare function pairs<TKey, TValue>(
161163
t: LuaTable<TKey, TValue>
162164
): LuaIterable<LuaMultiReturn<[TKey, TValue]>>;
163-
declare function pairs<T>(t: T): LuaIterable<LuaMultiReturn<[keyof T, T[keyof T]]>>;
165+
declare function pairs<T>(t: T): LuaIterable<LuaMultiReturn<[keyof T, NonNullable<T[keyof T]>]>>;
164166

165167
/**
166168
* Calls function f with the given arguments in protected mode. This means that

0 commit comments

Comments
 (0)