ActionsUnion<A extends ActionCreatorsObject> Type

ActionsUnion = ReturnType<>

A TypeScript type alias that represents the Union Type of all actions possibly created by any of the action creators in a given ActionCreatorsObject.

For example,

  // given:
  const MyActionCreators = {
    createBanana: () => createAction("BANANA"),
    createApple:  () => createAction("APPLE", true),
    createOrange: (n: number) => createAction("BANANA", n),
  }
  // then:
  type X = ActionsUnion<typeof MyActionCreators>;
  // is equivalent to:
  type X = Action<"BANANA">
           | ActionWithPayload<"APPLE", boolean>
           | ActionWithPayload<"ORANGE", number>;

Defined in

Last Updated: 17 December, 2024