Visual Studio Code Can Do That? Debugging with Type Checking
Transcript from the "Debugging with Type Checking" Lesson
[00:00:23] Let's say we'd added a console and we're gonna log out the color.
>> Speaker 2: Log not blog.
>> Burke Holland: Right, so we are now gonna console log this color, correct?
>> Speaker 2: You have canceled out blog.
>> Burke Holland: Yeah, we're not gonna console-
>> Speaker 2: Sorry [LAUGH] no-
>> Burke Holland: It's not gonna work.
[00:00:43] I wish blog was a command, but it isn't. So now here's the deal. The problem is if you had a linter, the linter would pick this up, but let's just assume that you don't have a linter running. One of the cool things about TypeScript is that it lints for you.
[00:00:58] So you don't actually have to be using TypeScript to exploit TypeScript's type checking and linting functionality in VS Code. This is one of the magical things about VS Code, it works with TypeScript with no configuration. Now, here's what you can do, I'm gonna come to the top here, and I'm going to put a comment.
[00:01:41] And we're just going down to the errors in the file, doesn't know what signalR is, that's a global variable. So I'm just gonna keep moving through. Doesn't see a style, doesn't think that's right. Some of these are okay, it's just TypeScript doesn't know what they are. But what's interesting is on the blog one, it says property blog does not exist on type console.
[00:02:19] That does not scale. So, let's take this out and look at a different way of doing this.
>> Burke Holland: Let's open up our settings file, and I've got a lot of settings. And I'm gonna get him down here to the bottom. Actually, I wanna take out these favorite colors here.
[00:02:37] Let's pull this out. And what I'm gonna do is I'm gonna add a setting called implicitProjectConfig.checkJs. Not super intuitive, but this basically says, check my project using the TypeScript compiler. That's what this setting means. So we'll set it on to true. Let's come back to our app file.
[00:03:57] And I think since I've changed all the paths and everything, yeah, it's working. The button doesn't look so good, but close enough. You know what it is, I think I modified that. This, yeah, right here, it's not columns, columns. It's just columns.
>> Burke Holland: Better, okay. Now's your turn.
[00:04:19] You get to go and go through all these steps and when you get the app running, feel free to change the colors on the lint to your heart's content.