Flow type checking a action$ observable
Asked Answered
D

1

7

Is it possible to flow type check an observable? I am using redux-observable to build out epics that watch for actions to dispatch and, if there is a match, they run some async code. The action$ argument to the epic is an observable, but there seems to be no Observable<> type in Flow. How does one properly assign a flow type to action$?

// @ flow
const fetchApiEpic = (action$) => {
  ...
};

Contents of action$:

enter image description here

Dives answered 18/2, 2017 at 12:28 Comment(0)
O
5

It's certainly possible to flow type RxJS and redux-observable, but neither library currently provides official type definitions for them so you'd need to find community ones (if they exist) or create your own.

The flow-typed projects contains unofficial type definitions for RxJS v5, but not any for redux-observable. You could use the TypeScript definition for it as a reference, if you wanted to create your own.

Oceanography answered 18/2, 2017 at 19:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.