Is there a way to create a unified union type based on the dynamic properties of an object?
const config = {
devices: {
Brand1: ['model1'],
Brand2: ['model2', 'model3'],
},
};
export type DeviceBrand = keyof typeof config.devices; // 'Brand1' | 'Brand2'
export type DeviceModel = ___________; // 'model1' | 'model2' | 'model3'
How can I transform DeviceModel into a union type that includes all models from the brands in the object?