'解构(缺失注释)'来源:'流动'

时间:2017-09-18 15:34:02

标签: javascript flowtype

我在ES6中进行解构时收到以下错误。 我想知道什么是正确的流程注释来防止此错误。

  

消息:'解构(缺少注释)'来源:'流程'



import React from 'react'
import { Provider } from 'react-redux'
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
import Forecast from './Forecast'
import Map from './Map'

const Root = ({ store }) => ( //<<<< ERROR HERE
  <Provider store={store}>
<Router>
  <Switch>
    <Route exact path='/' component={Forecast} />
    <Route exact path='/map' component={Map} />
  </Switch>
</Router>
  </Provider>
)
export default Root
&#13;
&#13;
&#13;

&#13;
&#13;
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import promiseMiddleware from 'redux-promise-middleware'
import reducers from './reducers'

const store = createStore(reducers, applyMiddleware(
  thunkMiddleware,
  promiseMiddleware()
))

export default store
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

您需要对type

store进行十分转换

例如:

const Root = ({ store } : {store : StoreType}) => {}