17 lines
376 B
TypeScript
17 lines
376 B
TypeScript
function wrapElementsMap<T extends Record<string, string>>(arg: T) {
|
|
return arg;
|
|
}
|
|
|
|
const elementsToActions = wrapElementsMap({
|
|
btnCalculate: 'calculate',
|
|
btnCreateKP: 'create-kp',
|
|
});
|
|
|
|
export type Elements = keyof typeof elementsToActions;
|
|
|
|
export function getAction(elementName: Elements) {
|
|
const actionName = elementsToActions[elementName];
|
|
|
|
return actionName;
|
|
}
|