One of the challenges I'm facing is defining an object based on a specific interface structure. The interface I have looks like this:
interface Store {
ReducerFoo : ReducerFooState;
ReducerBar : ReducerBarState;
ReducerTest : ReducerTestState;
}
I want to create an object with properties that follow this pattern:
[KeyName] : () => [TypeOfKey]
For instance, let's say we have FooReducer
ReducerFoo : () => ReducerFooState
This means my final object should resemble this:
{
ReducerFoo : () => ReducerFooState;
ReducerBar : () => ReducerBarState;
ReducerTest : () => ReducerTestState;
}
Is there a way to achieve this without having to define another separate interface for this specific object?
The reason behind this approach is that the Store
interface will likely change as my application grows. By following this method, I aim to streamline the process and avoid having to update multiple entities whenever a new property is added to the Store
interface.