-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for
using
keyword on discord.js Client
and `Web…
…SocketManager` (#10063) * feat: add support for `using` keyword on client * fix: use async dispose * feat: add support for web socket manager disposing * fix: use interface for client --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f48cb2a
commit 543d617
Showing
7 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Polyfill for `Symbol.dispose` and `Symbol.asyncDispose` which is used as a part of | ||
* {@link https://github.com/tc39/proposal-explicit-resource-management}. Node versions below 18.x | ||
* don't have these symbols by default, so we need to polyfill them. | ||
*/ | ||
export function polyfillDispose() { | ||
// Polyfill for `Symbol.dispose` and `Symbol.asyncDispose` if not available. | ||
// Taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management | ||
|
||
// @ts-expect-error This is a polyfill, so it's fine to write | ||
Symbol.dispose ??= Symbol('Symbol.dispose'); | ||
// @ts-expect-error Same as above | ||
Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters