Skip to content

Commit 1d606f6

Browse files
authoredJul 24, 2023
Allow functions as values in __addDisposableResource (#215)
1 parent 7c7f3ae commit 1d606f6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
 

‎tslib.es6.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export function __classPrivateFieldIn(state, receiver) {
294294

295295
export function __addDisposableResource(env, value, async) {
296296
if (value !== null && value !== void 0) {
297-
if (typeof value !== "object") throw new TypeError("Object expected.");
297+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
298298
var dispose;
299299
if (async) {
300300
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");

‎tslib.es6.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export function __classPrivateFieldIn(state, receiver) {
294294

295295
export function __addDisposableResource(env, value, async) {
296296
if (value !== null && value !== void 0) {
297-
if (typeof value !== "object") throw new TypeError("Object expected.");
297+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
298298
var dispose;
299299
if (async) {
300300
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");

‎tslib.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ var __disposeResources;
342342

343343
__addDisposableResource = function (env, value, async) {
344344
if (value !== null && value !== void 0) {
345-
if (typeof value !== "object") throw new TypeError("Object expected.");
345+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
346346
var dispose;
347347
if (async) {
348348
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");

0 commit comments

Comments
 (0)
Please sign in to comment.