使用@angular Redux/store时,Redux 4.0.0出现错误
编译时出现以下错误:使用@angular Redux/store时,Redux 4.0.0出现错误,angular,typescript,redux,angular-redux,Angular,Typescript,Redux,Angular Redux,编译时出现以下错误: ERROR in node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(10,31): error TS2420: Class 'NgRedux<RootState>' incorrectly implements interface 'ObservableStore<RootState>'. Types of property 'dispatch' are inco
ERROR in node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(10,31): error TS2420: Class 'NgRedux<RootState>' incorrectly implements interface 'ObservableStore<RootState>'.
Types of property 'dispatch' are incompatible.
Type 'Dispatch<RootState>' is not assignable to type 'Dispatch<AnyAction>'.
Type 'RootState' is not assignable to type 'AnyAction'.
node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(37,33): error TS2344: Type 'RootState' does not satisfy the constraint 'Action<any>'.
node_modules/@angular-redux/store/lib/src/components/root-store.d.ts(18,24): error TS2344: Type 'RootState' does not satisfy the constraint 'Action<any>'.
node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(10,31)中的错误:错误TS2420:类“NgRedux”错误地实现了接口“observestore”。
属性“dispatch”的类型不兼容。
类型“Dispatch”不可分配给类型“Dispatch”。
类型“RootState”不可分配给类型“AnyAction”。
node_modules/@angular redux/store/lib/src/components/ng redux.d.ts(37,33):错误TS2344:类型“RootState”不满足约束“Action”。
node_modules/@angular-redux/store/lib/src/components/root-store.d.ts(18,24):错误TS2344:类型“RootState”不满足约束“Action”。
环境设置:
ERROR in node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(10,31): error TS2420: Class 'NgRedux<RootState>' incorrectly implements interface 'ObservableStore<RootState>'.
Types of property 'dispatch' are incompatible.
Type 'Dispatch<RootState>' is not assignable to type 'Dispatch<AnyAction>'.
Type 'RootState' is not assignable to type 'AnyAction'.
node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(37,33): error TS2344: Type 'RootState' does not satisfy the constraint 'Action<any>'.
node_modules/@angular-redux/store/lib/src/components/root-store.d.ts(18,24): error TS2344: Type 'RootState' does not satisfy the constraint 'Action<any>'.
NodeJS版本:8.9.1
打字稿版本:2.8.1
角度版本:5.0.0
@角度冗余/存储版本:7.1.1
OS:Windows 10@angular redux/store github页面确认这是一个bug,将在未来的版本中修复
将Redux版本从4.0.0降级到3.7.0解决了目前的问题。您可以添加您的codeAdd代码,并且您是
RootState
类型,其中预期为AnyAction
。更具体地说,请显示ng Redux.d.ts
。为什么需要构建这种类型的defn?