You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could not get this to work. It kept throwing TypeError("Object not disposable."). I chose to implement a custom drop function on the guards instead, and have a try/finally helper to manage releasing the resources.
function__addDisposableResource(env,value,async){if(value!==null&&value!==void0){if(typeofvalue!=="object"&&typeofvalue!=="function")thrownewTypeError("Object expected.");vardispose;if(async){if(!Symbol.asyncDispose)thrownewTypeError("Symbol.asyncDispose is not defined.");dispose=value[Symbol.asyncDispose];}if(dispose===void0){if(!Symbol.dispose)thrownewTypeError("Symbol.dispose is not defined.");dispose=value[Symbol.dispose];}if(typeofdispose!=="function")thrownewTypeError("Object not disposable.");env.stack.push({value: value,dispose: dispose,async: async});}elseif(async){env.stack.push({async: true});}returnvalue;}var_SuppressedError=typeofSuppressedError==="function" ? SuppressedError : function(error,suppressed,message){vare=newError(message);returne.name="SuppressedError",e.error=error,e.suppressed=suppressed,e;};function__disposeResources(env){functionfail(e){env.error=env.hasError ? new_SuppressedError(e,env.error,"An error was suppressed during disposal.") : e;env.hasError=true;}functionnext(){while(env.stack.length){varrec=env.stack.pop();try{varresult=rec.dispose&&rec.dispose.call(rec.value);if(rec.async)returnPromise.resolve(result).then(next,function(e){fail(e);returnnext();});}catch(e){fail(e);}}if(env.hasError)throwenv.error;}returnnext();}
The text was updated successfully, but these errors were encountered:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html
I could not get this to work. It kept throwing
TypeError("Object not disposable.")
. I chose to implement a customdrop
function on the guards instead, and have a try/finally helper to manage releasing the resources.This is the typescript compiler output
The text was updated successfully, but these errors were encountered: