Skip to content

Type of Array.prototype[Symbol.unscopables] is wrong #46616

Closed

Description

@Jack-Works

lib Update Request

In lib.es2015.symbol.wellknown.d:

interface Array<T> {
    /**
     * Returns an object whose properties have the value 'true'
     * when they will be absent when used in a 'with' statement.
     */
    [Symbol.unscopables](): {
        copyWithin: boolean;
        entries: boolean;
        fill: boolean;
        find: boolean;
        findIndex: boolean;
        keys: boolean;
        values: boolean;
    };
}

Configuration Check

My compilation target is ES2015 and my lib is the default.

Missing / Incorrect Definition

It is an object, instead of a function that returns an object.

Sample Code

Documentation Link

Activity

  1. MartinJohns commented on Nov 1, 2021

    @MartinJohns
    Contributor

    It being an object seems to be right, according to the MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/unscopables

    What makes you think it should be a function returning an object?

  2. Jack-Works commented on Nov 1, 2021

    @Jack-Works
    ContributorAuthor

    The current definition in TypeScript is a function

  3. MartinJohns commented on Nov 1, 2021

    @MartinJohns
    Contributor

    Related: #34610

    It was wrongly fixed. :-D

  4. added
    Domain: lib.d.ts
    on Nov 4, 2021
  5. added
    Rescheduled
    on May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Domain: lib.d.tsRescheduled

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    ⌂ Proxy