bencompton / redux-retro

Bring back the clean, minimal-boilerplate syntax you enjoyed with classic Flux libraries, plus great TypeScript support
MIT License
7 stars 0 forks source link

Generate Actions #8

Open bencompton opened 8 years ago

bencompton commented 8 years ago

It would be useful to support this type of syntax:

class ShoppingCart extends Actions {
    constructor(store) {
        super(store);

        this.generateActions(
            'addToCart',
            'removeFromCart',
        )
    }
}

While this is handy for ES6, it would not work with so well with TypeScript for strongly typing the actions with their reducers. Actions generated in this manner are not strongly typed. Perhaps the generateActions method would simply not be exposed in the typings to ensure it isn't used with TypeScript.