从redux reducer返回流类型没有捕获错误

时间:2017-08-30 23:16:17

标签: react-native react-redux flowtype

我有一个流类型UserState,我将其定义为reducer的返回类型。我在返回类型中添加了一个额外的hey道具,但没有收到错误。我本来期待Property not found in object type无论如何,如果有人知道我做错了什么,我很乐意听到。感谢。

type UserState = {
  +female?: boolean,
}

const user = (state: UserState = {}, action: ReduxFetchUserAction): UserState => {
  switch (action.type) {
    case types.FETCH_USER_SUCCESS: {
      const newUser = { ...state, ...action.user, hey: 'whatgives' }
      return newUser
    }
    default:
      return state
  }
}

export default user

0 个答案:

没有答案