Skip to content

Commit

Permalink
Correction to Saga types
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-tavares committed Jan 15, 2020
1 parent df93581 commit 58d9036
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions x-pack/plugins/endpoint/public/applications/endpoint/lib/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
import { AnyAction, Dispatch, Middleware, MiddlewareAPI } from 'redux';
import { GlobalState } from '../store';

interface StoreAction extends AnyAction {
payload: unknown[];
type: string;
}

interface QueuedAction<TAction = StoreAction> {
interface QueuedAction<TAction = AnyAction> {
/**
* The Redux action that was dispatched
*/
Expand All @@ -30,9 +25,9 @@ interface IteratorInstance {

type Saga = (storeContext: SagaContext) => Promise<void>;

type StoreActionsAndState<TAction = StoreAction> = AsyncIterableIterator<QueuedAction<TAction>>;
type StoreActionsAndState<TAction = AnyAction> = AsyncIterableIterator<QueuedAction<TAction>>;

export interface SagaContext<TAction extends AnyAction = StoreAction> {
export interface SagaContext<TAction extends AnyAction = AnyAction> {
/**
* A generator function that will `yield` `Promise`s that resolve with a `QueuedAction`
*/
Expand Down Expand Up @@ -116,7 +111,7 @@ export function createSagaMiddleware(saga: Saga): Middleware {
});
runSaga();
}
return (next: Dispatch<StoreAction>) => (action: StoreAction) => {
return (next: Dispatch<AnyAction>) => (action: AnyAction) => {
// Call the next dispatch method in the middleware chain.
const returnValue = next(action);

Expand Down

0 comments on commit 58d9036

Please sign in to comment.