Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typings): Add generics so developer defines what redux Actions look like #105

Merged
merged 2 commits into from Sep 11, 2016

Conversation

@jayphelps
Copy link
Member

@jayphelps jayphelps commented Sep 9, 2016

Based on discovery and conversation of this issue on Gitter: https://gitter.im/redux-observable/redux-observable

You will now can pass in the expected shape of redux actions

interface FluxStandardAction {
  type: string | symbol | any;
  payload?: any;
  error?: boolean | any;
  meta?: any
}

const rootEpic = combineEpics<FluxStandardAction>(epic1, epic2);
const epicMiddleware = createEpicMiddleware<FluxStandardAction>(rootEpic);
// later

// types/generics inside epics can be inferred automatically!
const someEpic = (action$, store) =>
  action$.ofType(SOMETHING)
    .map(({ payload }) => ({
      type: ELSE,
      payload
    }));

Or of course you can use any by just not providing them

const epicMiddleware = createEpicMiddleware(rootEpic);

Cc/ @SethDavenport

@jayphelps jayphelps force-pushed the generics branch 2 times, most recently from 57c6b85 to 15ec2ad Sep 9, 2016
@jayphelps jayphelps force-pushed the generics branch 3 times, most recently from 5b22b24 to 065be61 Sep 9, 2016
@jayphelps jayphelps merged commit 7b4214f into master Sep 11, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@jayphelps
Copy link
Member Author

@jayphelps jayphelps commented Sep 11, 2016

Published as 0.10.0

@MaximeBernard MaximeBernard deleted the generics branch May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant