Skip to content

Commit fa090e9

Browse files
committed
fix(core): CHECKOUT-3007 Change ThunkAction return type to SubscribableOrPromise instead of concrete Observable type
1 parent cbd7bdc commit fa090e9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/data-store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default class DataStore<TState, TAction extends Action = Action, TTransfo
7171
options?: DispatchOptions
7272
): Promise<TTransformedState> {
7373
if (isObservableActionLike(action)) {
74-
return this._dispatchObservableAction(Observable.from(action), options);
74+
return this._dispatchObservableAction(action, options);
7575
}
7676

7777
if (typeof action === 'function') {
@@ -140,13 +140,13 @@ export default class DataStore<TState, TAction extends Action = Action, TTransfo
140140
}
141141

142142
private _dispatchObservableAction<TDispatchAction extends TAction>(
143-
action$: Observable<TDispatchAction>,
143+
action$: SubscribableOrPromise<TDispatchAction>,
144144
options: DispatchOptions = {}
145145
): Promise<TTransformedState> {
146146
return new Promise((resolve, reject) => {
147147
const error$ = this._getDispatchError(options.queueId);
148148
const transformedAction$ = this._options.actionTransformer(
149-
action$.map((action) =>
149+
Observable.from(action$).map((action) =>
150150
options.queueId ? merge({}, action, { meta: { queueId: options.queueId } }) : action
151151
)
152152
);

src/thunk-action.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Observable } from 'rxjs/Observable';
1+
import { SubscribableOrPromise } from 'rxjs/Observable';
22
import ReadableDataStore from './readable-data-store';
33

4-
type ThunkAction<TAction = any, TTransformedState = any> = (store: ReadableDataStore<TTransformedState>) => Observable<TAction>;
4+
type ThunkAction<TAction = any, TTransformedState = any> = (store: ReadableDataStore<TTransformedState>) => SubscribableOrPromise<TAction>;
55

66
export default ThunkAction;

0 commit comments

Comments
 (0)