2017-11-10 10 views
1

を与える:combineEpicsは私の叙事詩を組み合わせたときに、私はこのエラーを取得しています型エラー

TS2345: Argument of type 'Epic<SessionAction, GlobalState, any>' is not assignable to parameter of type 'Epic<EmployeeAction, GlobalState, any>'. 
Type 'SessionAction' is not assignable to type 'EmployeeAction'. 
Types of property 'type' are incompatible. 
    Type 'SessionActionTypes' is not assignable to type 'EmployeeActionTypes'. 

次のコードです:

import { combineEpics } from 'redux-observable'; 
import { fetchUserSession } from './sessionEpics'; 
import { fetchEmployee } from './employeeEpics'; 

export default combineEpics(
    fetchEmployee, 
    fetchUserSession 
); 
+0

あなたはこれを解決するために管理していましたか? –

答えて

0

私はかなり同じ問題を抱えています。それは、タイプスクリプトが最初の叙事詩をつかみ、そのタイプを推測し、残りがすべて同じであることを期待するようです。

私がしたのは最初のものでした。

例として、あなたのコードを使用する:

import { Observable } from 'rxjs/Observable'; 
import { AnyAction } from 'redux'; 
import { combineEpics } from 'redux-observable'; 
import { fetchUserSession } from './sessionEpics'; 
import { fetchEmployee } from './employeeEpics'; 

export default combineEpics(
    fetchEmployee as Observable<AnyAction>, 
    fetchUserSession 
); 
関連する問題