How can the code be optimized to automatically initialize a new product type without adding extra lines of code? Failure to initialize the variable results in a syntax error.
enum ProductType {
PC = 'pc',
LAPTOP = 'laptop',
TV = 'tv'
}
let productList: { [key in ProductType]: Product[] | undefined } = {
[ProductType.PC]: undefined,
[ProductType.LAPTOP]: undefined,
[ProductType.TV]: undefined
}