Skip to content

Commit 782ceb4

Browse files
committed
Added a Object.prototype.propertyIsEnumerable check to __rest to prevent enumerable symbols from sneaking through.
1 parent d2909a1 commit 782ceb4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compiler/transformers/destructuring.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,10 @@ namespace ts {
521521
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
522522
t[p] = s[p];
523523
if (s != null && typeof Object.getOwnPropertySymbols === "function")
524-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
525-
t[p[i]] = s[p[i]];
524+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
525+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable(p[i]))
526+
t[p[i]] = s[p[i]];
527+
}
526528
return t;
527529
};`
528530
};

0 commit comments

Comments
 (0)