I'm trying to refactor my redux action types to be enum type, but the problem is I would like to generate values through string concatenation.
Currently, my action looks like this (it is not symmetrical, so static generators won't work):
export const TYPE = '@@FOLDER';
export const FolderActionTypes = {
REQUEST: `${TYPE}/REQUEST`,
SUCCESS: `${TYPE}/SUCCESS`,
ERROR: `${TYPE}/ERROR`,
CHECK: `${TYPE}/CHECK`,
UNCHECK: `${TYPE}/UNCHECK`,
CLOSE: `${TYPE}/CLOSE`,
OPEN: `${TYPE}/OPEN`
};
How I would like to make it looks like:
export const TYPE = '@@FOLDER';
export enum FolderActionTypes = {
REQUEST = `${TYPE}/REQUEST`;
SUCCESS = `${TYPE}/SUCCESS`;
ERROR = `${TYPE}/ERROR`;
CHECK = `${TYPE}/CHECK`;
UNCHECK = `${TYPE}/UNCHECK`;
CLOSE = `${TYPE}/CLOSE`;
OPEN = `${TYPE}/OPEN`;
};
Is there any simple way to make it works?

@@FOLDERmultiple times, but it's important to me to keep action domain context.