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
The following check for the using keyword currently only allows it for objects. These lines will prevent the using keyword from being used on functions which is allowed in tsc.
thrownewTypeError("using declarations can only be used with objects, null, or undefined.");
}
A function can have the Symbol.dispose or Symbol.asyncDispose added to them to make them disposable just like how an object can. Here is the implementation in TypeScript, showing that it should allow the using keyword for functions.
This is based on a discussion about making spies and stubs disposable so that the originals will automatically be restored after they are no longer needed. This is needed to implement the feature.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the feature
The following check for the
using
keyword currently only allows it for objects. These lines will prevent theusing
keyword from being used on functions which is allowed in tsc.swc/packages/helpers/esm/_using.js
Lines 5 to 7 in d6cd214
A function can have the
Symbol.dispose
orSymbol.asyncDispose
added to them to make them disposable just like how an object can. Here is the implementation in TypeScript, showing that it should allow theusing
keyword for functions.https://github.com/microsoft/TypeScript/blob/36f9e9e037a8bf715d96c8270732d5830719d7c8/tests/baselines/reference/usingDeclarations.11.js#L57
Babel plugin or link to the feature description
No response
Additional context
This is based on a discussion about making spies and stubs disposable so that the originals will automatically be restored after they are no longer needed. This is needed to implement the feature.
denoland/std#3966
The text was updated successfully, but these errors were encountered: