Skip to content

Commit 86b48e3

Browse files
committed
Handel null and undefined in __rest
1 parent 216f286 commit 86b48e3

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed

src/compiler/transformers/destructuring.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ namespace ts {
459459
var t = {};
460460
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
461461
t[p] = s[p];
462-
if (typeof Object.getOwnPropertySymbols === "function")
462+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
463463
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
464464
t[p[i]] = s[p[i]];
465465
return t;

tests/baselines/reference/objectRest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var __rest = (this && this.__rest) || function (s, e) {
4343
var t = {};
4444
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4545
t[p] = s[p];
46-
if (typeof Object.getOwnPropertySymbols === "function")
46+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
4747
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
4848
t[p[i]] = s[p[i]];
4949
return t;

tests/baselines/reference/objectRestAssignment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var __rest = (this && this.__rest) || function (s, e) {
1919
var t = {};
2020
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2121
t[p] = s[p];
22-
if (typeof Object.getOwnPropertySymbols === "function")
22+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
2323
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
2424
t[p[i]] = s[p[i]];
2525
return t;

tests/baselines/reference/objectRestForOf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var __rest = (this && this.__rest) || function (s, e) {
2727
var t = {};
2828
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2929
t[p] = s[p];
30-
if (typeof Object.getOwnPropertySymbols === "function")
30+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
3131
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
3232
t[p[i]] = s[p[i]];
3333
return t;

tests/baselines/reference/objectRestNegative.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
2323
var t = {};
2424
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2525
t[p] = s[p];
26-
if (typeof Object.getOwnPropertySymbols === "function")
26+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
2727
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
2828
t[p[i]] = s[p[i]];
2929
return t;

tests/baselines/reference/objectRestParameter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
2222
var t = {};
2323
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2424
t[p] = s[p];
25-
if (typeof Object.getOwnPropertySymbols === "function")
25+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
2626
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
2727
t[p[i]] = s[p[i]];
2828
return t;

tests/baselines/reference/restIntersectionOrIntersection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var __rest = (this && this.__rest) || function (s, e) {
1616
var t = {};
1717
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1818
t[p] = s[p];
19-
if (typeof Object.getOwnPropertySymbols === "function")
19+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
2020
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
2121
t[p[i]] = s[p[i]];
2222
return t;

tests/baselines/reference/restInvalidArgumentType.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var __rest = (this && this.__rest) || function (s, e) {
6464
var t = {};
6565
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
6666
t[p] = s[p];
67-
if (typeof Object.getOwnPropertySymbols === "function")
67+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
6868
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
6969
t[p[i]] = s[p[i]];
7070
return t;

tests/baselines/reference/restUnion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
2020
var t = {};
2121
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2222
t[p] = s[p];
23-
if (typeof Object.getOwnPropertySymbols === "function")
23+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
2424
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
2525
t[p[i]] = s[p[i]];
2626
return t;

tests/baselines/reference/restUnion2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
2323
var t = {};
2424
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2525
t[p] = s[p];
26-
if (typeof Object.getOwnPropertySymbols === "function")
26+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
2727
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
2828
t[p[i]] = s[p[i]];
2929
return t;

0 commit comments

Comments
 (0)