Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface SymbolConstructor

Hierarchy

  • SymbolConstructor

Callable

  • __call(description?: string | number): symbol
  • Returns a new unique Symbol value.

    Parameters

    • Optional description: string | number

      Description of the new Symbol object.

    Returns symbol

Index

Properties

asyncIterator

asyncIterator: symbol

A method that returns the default async iterator for an object. Called by the semantics of the for-await-of statement.

hasInstance

hasInstance: 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.

isConcatSpreadable

isConcatSpreadable: symbol

A Boolean value that if true indicates that an object should flatten to its array elements by Array.prototype.concat.

iterator

iterator: symbol

A method that returns the default iterator for an object. Called by the semantics of the for-of statement.

match

match: symbol

A regular expression method that matches the regular expression against a string. Called by the String.prototype.match method.

prototype

prototype: Symbol

A reference to the prototype.

replace

replace: symbol

A regular expression method that replaces matched substrings of a string. Called by the String.prototype.replace method.

search

search: symbol

A regular expression method that returns the index within a string that matches the regular expression. Called by the String.prototype.search method.

species

species: symbol

A function valued property that is the constructor function that is used to create derived objects.

split

split: symbol

A regular expression method that splits a string at the indices that match the regular expression. Called by the String.prototype.split method.

toPrimitive

toPrimitive: symbol

A method that converts an object to a corresponding primitive value. Called by the ToPrimitive abstract operation.

toStringTag

toStringTag: symbol

A String value that is used in the creation of the default string description of an object. Called by the built-in method Object.prototype.toString.

unscopables

unscopables: symbol

An Object whose own property names are property names that are excluded from the 'with' environment bindings of the associated objects.

Methods

for

  • for(key: string): symbol
  • Returns a Symbol object from the global symbol registry matching the given key if found. Otherwise, returns a new symbol with this key.

    Parameters

    • key: string

      key to search for.

    Returns symbol

keyFor

  • keyFor(sym: symbol): string | undefined
  • Returns a key from the global symbol registry matching the given Symbol if found. Otherwise, returns a undefined.

    Parameters

    • sym: symbol

      Symbol to find the key for.

    Returns string | undefined