Mutability 12 exercises

Object Property Inference

In this exercise, we are dealing with a modifyButton function. This function takes in some attributes which are defined in the ButtonAttributes type.

The ButtonAttributes type has a single property, type, which can be either "button", "submit", or "reset".

Following this, we have a declar

Loading exercise


00:00 In this exercise, we have a ModifyButton function which takes in some attributes, which are button attributes. Similar to the previous exercise, this is just an object type with a type property, same button or submit or reset. We're then declaring a button attributes object with a type of button, and then we're passing it into our ModifyButton function.

00:19 But we're getting an error in here, very similar error to the one that we had before. We also have a similar setup down the bottom here, which is a ModifyButtons function, which takes in an array of button attributes. And then we have inside here buttons to change, which is an array of type button and type submit.

00:38 We're passing that into a ModifyButtons function, and we're getting a very similar error. Your job is to work out why that would be happening and also how to fix it. Good luck.