Skip to content

Subclassing Array doesn't work #3181

@kasperpeulen

Description

@kasperpeulen

I have the following code:

export default class Days extends Array {
  today() {
    return this.find(day => day.startedAt.isSame(moment(), 'day'));
  }
}

This code works if I just copy paste it to the chrome console, but not in create react app:

image

Anyway to get this to somehow transpile correctly? I tried importing babel-polyfill.

Also, is it possible to somehow tell create-react-app that I don't need to support IE11? Because I think that otherwise, this could work natively, and I wouldn't need a polyfill.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions