Skip to content

Commit 09132b3

Browse files
authored
Merge pull request #20 from Microsoft/updateExtends
Update extends to use `setPrototypeOf` when available
2 parents d0078f4 + b6d3732 commit 09132b3

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

tslib.es6.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions
1313
and limitations under the License.
1414
***************************************************************************** */
1515
/* global Reflect, Promise */
16+
17+
var extendStatics = Object.setPrototypeOf ||
18+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
20+
1621
export function __extends(d, b) {
17-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
22+
extendStatics(d, b);
1823
function __() { this.constructor = d; }
1924
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
20-
};
25+
}
2126

2227
export var __assign = Object.assign || function __assign(t) {
2328
for (var s, i = 1, n = arguments.length; i < n; i++) {

tslib.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ var __generator;
3737
}
3838
})
3939
(function (exporter) {
40+
var extendStatics = Object.setPrototypeOf ||
41+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
42+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
43+
4044
__extends = function (d, b) {
41-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
45+
extendStatics(d, b);
4246
function __() { this.constructor = d; }
4347
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4448
};

0 commit comments

Comments
 (0)