In this snippet of code, the thread does not complain that the value of dog
set to state. It seems to be ignoring the definition of NamespaceData
. I created types to complain. I am running through a nuclide and the thread is working correctly for everything else.
All action
properties such as namespace
, project
, collection
are strings.
// @flow import { NAMESPACE_SET } from '../actions/NamespaceActions' type NamespaceData = { project: string, collection: string, } type NamespaceState = { [namespace: string]: NamespaceData, } const initialState: NamespaceState = {} function namespaceReducer(state: NamespaceState = initialState, action: Object): NamespaceState { switch (action) { case NAMESPACE_SET: { return { ...state, [action.namespace]: { project: action.project, collection: action.collection, dog: 1, } } } } return state } export default namespaceReducer
source share