Hacker News new | ask | show | jobs
by WayneBro 3559 days ago
Could you then do the case statements in the reducer like this?

    switch (action.type) {
    case IncrementCounterAction.type:
        return state.update(...);
    case DeccrementCounterAction.type:
        return state.update(...);
    ....
    }
1 comments

I believe you can, though I haven't tried it. Typescript will actually give you completion support for plain strings inside that switch statement, which is normally what I go with.