So I want to create a type that maps dynamically the properties of the passed type to an array of key properties. The idea is to create a type validation that only allows passing a name that belongs to the class or sublcasss. Example:
class User {
id:number;
email:string;
profile: Profile;
}
class Profile {
id:number;
name:string;
}
// Expecten outcome for this would be ['id,'email','profile.id', 'profile.name']
type arrayOfProperties = MyFlattenType<User>;
I've tried different approaches but none of them work as intended. I'm having trouble figuring out how to return the array since most of the reading that I made all the examples returned an object.