Fixing "Property Does Not Exist On Type"
Here we have a user
object that just contains a name set to 'Matt':
const user = {
name: "Matt",
};
We then pass in an age of 24:
user.age = 24; // red squiggly line under age
There is an error underneath age
that reads:
// hovering over ag
Transcript
00:00 In this exercise, we have a user object, which just has a name of Matt, and then we're passing in an age of 24. 24, huh? I wish I was 24. Here, we're getting this funny error saying property age does not exist on type name string. Your job is to work out how we can potentially make this error go away
00:18 without changing the runtime code too much. And yeah, I think that's all I'm gonna give you. I think I have two or three solutions to this. Good luck.