在ng2 /打字稿中使用redux,无法使用combineReducers

时间:2016-12-13 21:28:06

标签: angular typescript redux

我正在玩一个Angular 2应用程序。当我运行它时,我收到此错误:

ERROR in ./src/app/store/store.ts
Module build failed: Error: /Users/benhernandez/angular-force/src/app/store/store.ts (10,14):
Exported variable 'rootReducer' has or is using name 'Action' from external module "/Users/benhernandez/angular-force/node_modules/redux/index" but cannot be named.)
at _checkDiagnostics (/Users/benhernandez/angular-force/node_modules/@ngtools/webpack/src/loader.js:115:15)
at /Users/benhernandez/angular-force/node_modules/@ngtools/webpack/src/loader.js:140:17
@ ./src/app/store/index.ts 1:0-69
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main

第10行的代码是:

export const rootReducer = combineReducers<State>({
  twiglet: twiglet.twigletReducer,
  view: view.viewReducer,
});

感谢任何帮助。我相信我错过了一些明显的东西。

1 个答案:

答案 0 :(得分:0)

结束搞清楚我的问题,angular不包括来自redux的Action,改变了我的import语句

import { combineReducers } from 'redux';

import { Action, combineReducers } from 'redux';

并修复了它。