1
私は単方向のデータフローを作成するために使用している単純なAngular 2サービスを持っています。したがって、サービスはアクション(action$
)を公開し、コンポーネントはaction$.next(game)
を呼び出すことができます。サービスはこのアクションにサブスクライブし、すべてのリスナーに再発行します。引数タイプfunction(Game、string)はパラメータタイプに割り当てられませんPartialObserver <Game> | function(Game):void
constructor() {
this.action$ = new Subject();
// Subscribe to actions
this.action$.subscribe(this.handleAction);
}
handleAction(game: Game, playerId: string) {}
はしかし、私はエラーを取得しています:
Argument type function(Game, string) is not assignable to parameter type PartialObserver<Game>|function(Game): void
私はplayerId: string
を削除した場合、それは動作しますが、function(Game): void
定義がどこから来ている私は理解していません。