From 47a70d8ec3af843d7b16b71c278def7383934a3a Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 17 Jul 2023 18:35:16 -0400 Subject: [PATCH] Allow functions as values in __addDisposableResource --- tslib.es6.js | 2 +- tslib.es6.mjs | 2 +- tslib.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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.");