Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flow type checking a action$ observable

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

like image 966
Jon Cursi Avatar asked Feb 18 '17 12:02

Jon Cursi


1 Answers

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.

like image 137
jayphelps Avatar answered Oct 17 '22 23:10

jayphelps