Skip to content

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

Open
@DirkWolthuis

Description

@DirkWolthuis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions