Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Subclassing #58

Closed
Closed

Description

class MyMap extends Map { /* ... */ }
MyMap.groupBy(something, fn) instanceof MyMap; // -> false

image
Why? Object always was a special case, more other, Object.groupBy should create an object with null prototype. But Map... Unlike some new instance methods where TC39 decided to break subclassing, new static methods use proper subclassing and create new instances from this. Promise.any, Array.fromAsync, Promise.withResolvers, etc...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions