I need to recursively get through the data structure and create a type that has some of the fields changed to a different type, based on a condition.
Based on the following structure, I need to create a type (Result) where all A types are replaced with B types.
class A{}
class B{}
const data = {
propA:new AA,
propB:true,
nested:{
propC:new AA,
propD:false
}
}
// something like:
type Replace<typeof data, A, B>
// result
type Result = {
propA:B,
propB:boolean,
nested:{
propC:B
propD:boolean
}
}