Consider an enum scenario:
enum AlertAction {
RESET = "RESET",
RESEND = "RESEND",
EXPIRE = "EXPIRE",
}
We aim to generate various actions, illustrated below:
type Action<T> = {
type: T;
payload: string;
};
type ActionType =
| Action<Action.RESET>
| Action<Action.RESEND>
| Action<Action.EXPIRE>;
In ActionType
, the code Action<enum> is repeated several times.
Is there a way to avoid redundantly writing Action<enum>?