ActionTypes<A extends Action<any>> Type Alias

A TypeScript type alias that uses conditional types (read: magic) to represent the exact (literal) type of an action's type property.

More importantly, this can be used to determine a union type which represents the type string literal types for any action in a given ActionsUnion.

For example,

// given: type MyActions = Action<"BANANA"> | ActionWithPayload<"APPLE", boolean> | ActionWithPayload<"ORANGE", number>; // then: type X = ActionTypes<MyActions>; // is equivalent to: type X = "BANANA" | "APPLE" | "ORANGE";

Defined in

Last Updated: 29 April, 2025