import * as Actions from '../actions/types';
import ActionType = Actions.ActionType;

export default function store(state: ApplicationState = { containers: [], hosts: [] }, action: ActionType): ApplicationState {
    switch (action.kind) {
        case Actions.ADD_CONTAINER:
            return Object.assign(
                {},
                state,
                { containers: [...state.containers, action.container] }
            )
        case Actions.ADD_HOST:
            return Object.assign(
                {},
                state,
                { hosts: [...state.hosts, action.host] }
            )
        case Actions.REMOVE_HOST:
            return Object.assign(
                {},
                state,
                { containers: state.containers.filter(c => c.id !== action.id) }
            )
        case Actions.REMOVE_CONTAINER:
            return Object.assign(
                {},
                state,
                { hosts: state.hosts.filter(c => c.id !== action.id) }
            )
    }
}

interface ApplicationState {
    containers: Array<Concierge.APIContainer>;
    hosts: Array<Concierge.APIHost>;
}


import {ActionType} from '../actions/types';

export default function store(state: ApplicationState = { containers: [], hosts: [] }, action: ActionType): ApplicationState {
    switch (action.kind) {
        case 'ADD_CONTAINER':
            return Object.assign(
                {},
                state,
                { containers: [...state.containers, action.container] }
            )
        case 'ADD_HOST':
            return Object.assign(
                {},
                state,
                { hosts: [...state.hosts, action.host] }
            )
        case 'REMOVE_CONTAINER':
            return Object.assign(
                {},
                state,
                { containers: state.containers.filter(c => c.id !== action.id) }
            )
        case 'REMOVE_CONTAINER':
            return Object.assign(
                {},
                state,
                { hosts: state.hosts.filter(c => c.id !== action.id) }
            )
    }
}

interface ApplicationState {
    containers: Array<Concierge.APIContainer>;
    hosts: Array<Concierge.APIHost>;
}


--- 
+++ 
@@ -1,26 +1,27 @@
-import {ActionType} from '../actions/types';
+import * as Actions from '../actions/types';
+import ActionType = Actions.ActionType;
 
 export default function store(state: ApplicationState = { containers: [], hosts: [] }, action: ActionType): ApplicationState {
     switch (action.kind) {
-        case 'ADD_CONTAINER':
+        case Actions.ADD_CONTAINER:
             return Object.assign(
                 {},
                 state,
                 { containers: [...state.containers, action.container] }
             )
-        case 'ADD_HOST':
+        case Actions.ADD_HOST:
             return Object.assign(
                 {},
                 state,
                 { hosts: [...state.hosts, action.host] }
             )
-        case 'REMOVE_CONTAINER':
+        case Actions.REMOVE_HOST:
             return Object.assign(
                 {},
                 state,
                 { containers: state.containers.filter(c => c.id !== action.id) }
             )
-        case 'REMOVE_CONTAINER':
+        case Actions.REMOVE_CONTAINER:
             return Object.assign(
                 {},
                 state,
Use action kind references in reducers
