Consider the following Enum instances:
export enum TopicCategories {
GUIDES = 'Guides',
TASKS = 'Tasks',
CONCEPTS = 'Concepts',
FORMULAS = 'Formulas',
BLOGS = 'Blogs'
}
export enum TopicTypes {
GUIDES = 'guide',
TASK = 'task',
CONCEPT = 'concept',
FORMULA = 'formula',
BLOG = 'blog'
}
export const topicCategoryToTopicTypeMap:Map<TopicCategories, TopicTypes> = new Map();
topicCategoryToTopicTypeMap.set(TopicCategories.BLOGS, TopicTypes.BLOG);
The purpose of topicCategoryToTopicTypeMap:Map
is to retrieve TopicType.BLOG
by using TopicCategory.BLOG
as a key.
Is there a way to achieve this mapping directly without utilizing the Map
instance and relying solely on the Enum
instances?