type Dog = { name: string; furColor: "brown" | "white" };
const addLocation = (animals: Dog[], location: "Italy" | "France") =>
animals.map((animal) => (animal.location = location)); // animal.location throws error (see below)
throws
Property 'location' does not exist on type 'Dog'.ts(2339)
Is there a way to keep the Dog
type as it is and to introduce a new type like LocationAddedDog
in the addLocation
function?