diff --git a/tslib.es6.js b/tslib.es6.js index 801630c..270cc22 100644 --- a/tslib.es6.js +++ b/tslib.es6.js @@ -294,7 +294,7 @@ export function __classPrivateFieldIn(state, receiver) { export function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { - if (typeof value !== "object") throw new TypeError("Object expected."); + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); diff --git a/tslib.es6.mjs b/tslib.es6.mjs index 3f941d2..c8e2999 100644 --- a/tslib.es6.mjs +++ b/tslib.es6.mjs @@ -294,7 +294,7 @@ export function __classPrivateFieldIn(state, receiver) { export function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { - if (typeof value !== "object") throw new TypeError("Object expected."); + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); diff --git a/tslib.js b/tslib.js index 54c30ed..343ecde 100644 --- a/tslib.js +++ b/tslib.js @@ -342,7 +342,7 @@ var __disposeResources; __addDisposableResource = function (env, value, async) { if (value !== null && value !== void 0) { - if (typeof value !== "object") throw new TypeError("Object expected."); + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");