I have a const enum named ComponentId with values A, B, and C. Additionally, there is another const enum called BaseId with values D, E, and F which is used in multiple places.
const enum ComponentId {
A = 0,
B,
C
}
The challenge I am facing is that I want to be able to utilize BaseId in the same places where ComponentId is being used:
function operateComponent(id: ComponentId) // want to be able to use BaseId as well
One approach could be to modify the function signature to id: ComponentId | BaseId, but this would require changes in many parts of the codebase. I am seeking advice on the best practice to achieve this goal efficiently?