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

Typescript: what is the correct way of providing types for the actions? #9

Open
DirkWolthuis opened this issue Nov 3, 2020 · 1 comment

Comments

@DirkWolthuis
Copy link

Hi!

 const [state, dispatch] = useCombinedReducers<
    { documentWizard: DocumentWizardState; steps: StepState },
    documentWizardActions & StepActions
  >({
    documentWizard: useReducer(
      documentWizardReducer,
      initialDocumentWizardState
    ),
    steps: useReducer(stepReducer, initialStepState),
  });

What is the correct way of providing the documentWizardActions & StepActions as second argument to the types of useCombinedReducers? The union operator does not work, also not the if ( | ) operator.

@fmrogers
Copy link

I would like to see a typescript example for how to use combined reducer. I am getting som pretty strange type errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants