Skip to content

Commit

Permalink
Fix typings for dispatch method (angular-redux#390)
Browse files Browse the repository at this point in the history
This is important for middlewares like redux-thunk that allow you to dispatch other things than Actions.

[Fixes angular-redux#264] [Fixes angular-redux#386] [Fixes angular-redux#211]
  • Loading branch information
SethDavenport authored and e-schultz committed May 12, 2017
1 parent 918221b commit 78efa4b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/ng-redux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
Unsubscribe,
createStore,
applyMiddleware,
compose
compose,
Dispatch,
} from 'redux';

import { NgZone } from '@angular/core';
Expand Down Expand Up @@ -166,7 +167,7 @@ export class NgRedux<RootState> {
/**
* Dispatch an action to Redux
*/
dispatch = <A extends Action>(action: A): any => {
dispatch: Dispatch<RootState> = action => {
if (!this._store) {
throw new Error('Dispatch failed: did you forget to configure your store? ' +
'https://github.com/angular-redux/@angular-redux/core/blob/master/' +
Expand Down

0 comments on commit 78efa4b

Please sign in to comment.