From f14d4aea05cca9a94a53e9cf342163d3dfa5e5cd Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Wed, 14 Feb 2024 19:01:43 -0500 Subject: [PATCH 1/2] Add Symbol types --- types/Symbol.d.ts | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/types/Symbol.d.ts b/types/Symbol.d.ts index fd15a2a..0307ab6 100644 --- a/types/Symbol.d.ts +++ b/types/Symbol.d.ts @@ -10,10 +10,37 @@ interface Symbol { * @deprecated */ readonly _nominal_Symbol: unique symbol; + + description?: string | number; } interface SymbolConstructor { - readonly iterator: symbol; - readonly asyncIterator: symbol; + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string | number): symbol; + + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: unique symbol; + + /** + * A method that returns the default async iterator for an object. Called by the semantics of + * the for-await-of statement. + */ + readonly asyncIterator: unique symbol; + + /** + * A method that is used to release resources held by an object. Called by the semantics of the `using` statement. + */ + readonly dispose: unique symbol; + + /** + * A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement. + */ + readonly asyncDispose: unique symbol; } declare const Symbol: SymbolConstructor; From dfa8efd052643c0d6f4beb0d90aff30bc4f28739 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Fri, 16 Feb 2024 01:16:37 -0500 Subject: [PATCH 2/2] Add Symbol.hasInstance --- types/Symbol.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/Symbol.d.ts b/types/Symbol.d.ts index 0307ab6..7fa5082 100644 --- a/types/Symbol.d.ts +++ b/types/Symbol.d.ts @@ -21,6 +21,12 @@ interface SymbolConstructor { */ (description?: string | number): symbol; + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: unique symbol; + /** * A method that returns the default iterator for an object. Called by the semantics of the * for-of statement.