◐ Shell
clean mode source ↗

TypeError: clazz is not a constructor on ≥ v11.6.0

I'm experiencing an issue with a following piece of code

screen shot 2019-01-11 at 10 27 41 pm

'use strict';

const people = [
  ['John', 19, 'm'],
  ['Valentine', 28, 'f'],
  ['Christina', 25, 'f']
];

class Person {
  get name() {
    return this[0];
  }
  
  get age() {
    return this[1];
  }
  
  get sex() {
    return this[2];
  }
}

people.forEach(person => Object.setPrototypeOf(person, Person.prototype));

const query = person => person.age > 25;

people.filter(query);

You can see a more detailed information about the stacktrace right below
screen shot 2019-01-11 at 10 49 55 pm

  • Node: v11.6.0:
  • Platform: macOS Mojave Version 10.14.2: