Configuring TypeScript 16 exercises

Using TypeScript as a Linter

TypeScript can be configured to act more like a linter, rather than a transpiler. This configuration is helpful if you have another process or tool handling your code, and you only want TypeScript to check your code for type-related issues without transpiling it into JavaScript.

Here we have a `my

Loading exercise


00:00 In this exercise, we have a file here called index.ts that's exporting const myfunc, and inside myfunc, it's saying console.log hello. Now, we actually have a bundler set up that's not TypeScript that's going to actually handle this code for us. It's not, you can imagine that. I haven't actually got it set up here.

00:17 But we have inside our dev script a tscwatch command. And what's happening is when tscwatch is running is it's emitting some JavaScripts here. It's actually emitting a bunch of stuff. So if we look here and we go back to source here, whenever I change this, then it's going to actually change inside here.

00:35 So I console.log goodbye like this, and it changes inside the JavaScript. We actually want to use TypeScript more like a linter. We don't want it to say, okay, actually put some stuff into the dist folder for us. We just want to say, yeah, don't actually emit anything whenever you run tsc.

00:54 Your job is to look either in the package.json here or look in the tsconfig.json to figure out which option we can use to actually stop TypeScript from emitting JavaScript and make it treat us or make us treat it more like a linter. Good luck.