reflux / refluxjs

A simple library for uni-directional dataflow application architecture with React extensions inspired by Flux
BSD 3-Clause "New" or "Revised" License
5.36k stars 330 forks source link

TypeError: Super expression must either be null or a function, not undefined #541

Closed kingangelAOA closed 6 years ago

kingangelAOA commented 6 years ago

version: reflux@^6.4.1

var Reflux = require('reflux')

var Actions = Reflux.createActions(['increment', 'decrement', 'changeBy']);

class MyStore extends Reflux.Store {
    constructor()
    {
        super();
        this.state = {count: 0};
        this.listenToMany(Actions);
        //this.listenables = Actions; // <- would work equally well
    }

    increment()
    {
        var newCount = this.state.count + 1;
        this.setState({count: newCount});
    }

    decrement()
    {
        var newCount = this.state.count - 1;
        this.setState({count: newCount});
    }

    changeBy(amount)
    {
        var newCount = this.state.count + amount;
        this.setState({count: newCount});
    }
}

then:

TypeError: Super expression must either be null or a function, not undefined at _inherits (/Users/kingangeltot/Applications/git_work/node_work/universal/test.js:1:975) at /Users/kingangeltot/Applications/git_work/node_work/universal/test.js:1:1461 at Object. (/Users/kingangeltot/Applications/git_work/node_work/universal/test.js:1:2095) at Module._compile (module.js:660:30) at loader (/Users/kingangeltot/Applications/git_work/node_work/universal/node_modules/babel-register/lib/node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (/Users/kingangeltot/Applications/git_work/node_work/universal/node_modules/babel-register/lib/node.js:154:7) at Module.load (module.js:573:32) at tryModuleLoad (module.js:513:12) at Function.Module._load (module.js:505:3) at Function.Module.runMain (module.js:701:10)

BryanGrezeszak commented 6 years ago

Confirmed that this works fine in normal JS: jsfiddle

I don't do typescript, and it's not a JS library error. So unless someone comes along here that does typescript, I think your best bet is stack overflow.