Handling Form Errors and User Mistakes
00:00 So we've got this TS expect error here, and that's because the title and content could be something that we don't want them to be. It is very possible that a user could change the DOM and then submit a file instead, or they could hit this API directly without using the form at all.
00:19 So we can't really rely on the fact that our form is being submit properly, and for those types of scenarios, I actually don't care too much about their experience. If they're using things wrong, then they don't deserve a good experience. But it is also possible that we could have made a mistake,
00:36 like maybe we have some typo or something like that. So we should probably handle those better, and we need to consider all of those cases anyway. So again, TypeScript isn't making your life terrible, it's just showing you how terrible your life is. We're going to make TypeScript happy
00:55 and handle these error cases at the same time. So that's your job is to handle these error cases. If you want to experiment with this a little bit to make sure that things are happening the way you expect, you can simply just change the name of one of these and make sure that you're getting what you expect.
01:15 You could also say that the type is a file and then try to upload a file and see what happens with that. So that's your objective for this exercise. I think that you should have a good time doing it, and we'll see you when you're done.