Skip to content

Commit 782f831

Browse files
committed
refactor __TS__ObjectAssign to emit cleaner Lua
Invert the type guard so it nests the spread loop instead of using `continue`, which lowered to a `repeat ... until true` + `break` dance. Same behavior, the bundled helper now reads like the hand-written original.
1 parent c8cb103 commit 782f831

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/lualib/ObjectAssign.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
export function __TS__ObjectAssign<T extends object>(this: void, target: T, ...sources: T[]): T {
33
for (const i of $range(1, sources.length)) {
44
const source = sources[i - 1];
5-
if (type(source) !== "table") continue;
6-
for (const key in source) {
7-
target[key] = source[key];
5+
if (type(source) === "table") {
6+
for (const key in source) {
7+
target[key] = source[key];
8+
}
89
}
910
}
1011

0 commit comments

Comments
 (0)