Jon Cursi
Jon Cursi

Reputation: 3371

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

Upvotes: 7

Views: 1039

Answers (1)

jayphelps
jayphelps

Reputation: 15401

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.

Upvotes: 5

Related Questions