Interface SymbolConstructor

    interface SymbolConstructor {
        asyncIterator: typeof asyncIterator;
        hasInstance: typeof hasInstance;
        isConcatSpreadable: typeof isConcatSpreadable;
        iterator: typeof iterator;
        match: typeof match;
        matchAll: typeof matchAll;
        prototype: Symbol;
        replace: typeof replace;
        search: typeof search;
        species: typeof species;
        split: typeof split;
        toPrimitive: typeof toPrimitive;
        toStringTag: typeof toStringTag;
        unscopables: typeof unscopables;
        for(key: string): symbol;
        keyFor(sym: symbol): string;
        (description?: string | number): symbol;
    }
    • Returns a new unique Symbol value.

      Parameters

      • Optionaldescription: string | number

        Description of the new Symbol object.

      Returns symbol

    Properties

    asyncIterator: typeof asyncIterator

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

    hasInstance: typeof hasInstance

    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: typeof isConcatSpreadable

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

    iterator: typeof iterator

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

    match: typeof match

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

    matchAll: typeof matchAll

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

    prototype: Symbol

    A reference to the prototype.

    replace: typeof replace

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

    search: typeof search

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

    species: typeof species

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

    split: typeof split

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

    toPrimitive: typeof toPrimitive

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

    toStringTag: typeof toStringTag

    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: typeof unscopables

    An Object whose truthy properties are properties that are excluded from the 'with' environment bindings of the associated objects.

    Methods

    • 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

    • 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