Skip to content

SignalArray is not subclassable #96

@justinfagnani

Description

@justinfagnani

Subclassing SignalArray doesn't work even when there are no build errors.

Example:

import {SignalArray} from 'signal-utils/array';

class MyArray<T> extends SignalArray<T> {  
  sayHello() {
    return 'Hello';
  }
}

const a = new MyArray(['a', 'b', 'c']);
console.log(a.constructor.name);
console.log(a.sayHello());

This logs:

Array

Then throws Uncaught TypeError: a.sayHello is not a function

Metadata

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