Answer the question
In order to leave comments, you need to log in
What is the best way for me to style Union types for actions?
I have an enum with action names:
export enum ResearchActionTypes {
SAVE_CATEGORY = 'SAVE_CATEGORY',
SAVE_PROJECT_NAME = 'SAVE_PROJECT_NAME',
SAVE_BRIEF = 'SAVE_BRIEF',
SAVE_USER_INFO = 'SAVE_USER_INFO',
UPDATE_LOCAL_PATH = 'UPDATE_LOCAL_PATH',
SAVE_REPORT_TYPE = 'SAVE_REPORT_TYPE',
SAVE_OBJECTIVES = 'SAVE_OBJECTIVES',
SAVE_ACTIVE_CHAPTER = 'SAVE_ACTIVE_CHAPTER',
SAVE_INDUSTRIES = 'SAVE_INDUSTRIES',
SAVE_TARGET = 'SAVE_TARGET',
SAVE_REGIONS = 'SAVE_REGIONS',
SAVE_PRESET_TAGS = 'SAVE_PRESET_TAGS',
UPDATE_SCREEN_STEP = 'UPDATE_SCREEN_STEP',
}
Answer the question
In order to leave comments, you need to log in
export type SaveCategoryAction = {
type: 'SAVE_CATEGORY',
foo: number;
// .....
}
export type SaveProjectNameAction = {
type: 'SAVE_PROJECT_NAME',
bar: string;
// .....
}
export type ResearchAction = SaveCategoryAction | SaveProjectNameAction;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question