Solución
solution.tsTypeScript
interface Entity {
id: number;
createdAt: string;
}
interface Product extends Entity{
// Hacé que Product extienda Entity y agrega name y price
name: string;
price: number;
}
interface PhysicalProduct extends Product {
// Hacé que PhysicalProduct extienda Product y agrega weightKg y stock
weightKg: number;
stock: number;
}
export function getPhysicalProduct(): PhysicalProduct {
const item: PhysicalProduct = {
id: 1,
createdAt: '2024-01-15',
name: 'Mochila',
price: 49.99,
weightKg: 0.8,
stock: 100
}
return item;
}0respuestas