Let's say we have such a simple example:
interface Steps { stepOne?: boolean; stepTwo?: boolean; stepThree?: boolean; } let steps: Steps = {}; function markStepDone (step: ???) { steps[step] = true; } markStepDone('anything');
How can I stop him from passing βanythingβ to this function and allow only ['stepOne', 'stepTwo', 'stepThree']?
I also tried to do this with an enumeration, but it turned out that you cannot use enum as an index signature ...
source share