tengo este codigo
type VehicleDetails = {made: string} function doSomethingWithVehicleDetails (details: VehicleDetails) { //what to add here for newProperty? console.log(details); } doSomethingWithVehicleDetails({ made: '123', newProperty: true }) sin modificar type VehicleDetails = {made: string} , ¿cómo puedo agregar newProperty en el argumento doSomethingWithVehicleDetails para corregir el error?
Podrías hacer algo como esto:
type VehicleDetails = {made: string}; function doSomethingWithVehicleDetails (details: VehicleDetails & { newProperty: boolean }) { console.log(details); } doSomethingWithVehicleDetails({ made: '123', newProperty: true });