diff --git a/tslib.es6.js b/tslib.es6.js index d2ce81c..2a5c518 100644 --- a/tslib.es6.js +++ b/tslib.es6.js @@ -108,14 +108,15 @@ export function __exportStar(m, exports) { } export function __values(o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); } export function __read(o, n) { diff --git a/tslib.js b/tslib.js index 303bc52..7034196 100644 --- a/tslib.js +++ b/tslib.js @@ -145,14 +145,15 @@ var __importDefault; }; __values = function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; __read = function (o, n) {