Seeking a way to automatically generate types based on given function types. I want to extract the return type directly from the function and map it to the key of the object as shown below. I attempted using ReturnType
but encountered issues with the reducers
structure.
type A = { a: string }
type B = { b: string }
type Reducers = {
aA: (a) => A,
bB:(b) => B,
}
const reducers: Reducers = {
aA: (a) => { a },
bB: (b) => {b },
}
Any suggestions on how to retrieve the store state?
namespace Store { // I will provide this
type Project = { // here is where I need to generated types based on reducer function like`type Project = ....`
aA: A,
bB: B,
}
}