1 00:00:02,500 --> 00:00:07,860 So now did we have a understanding of how we can manage our files with the compiler. 2 00:00:07,900 --> 00:00:11,290 Let's dive into the compiler options because that's really interesting. 3 00:00:11,290 --> 00:00:16,620 This allows us to control how our types could code is compiled. 4 00:00:16,630 --> 00:00:23,390 So not only which files but also how the files which are getting compiled are treated by typescript. 5 00:00:23,500 --> 00:00:26,730 And there you see we have a bunch of options. 6 00:00:26,780 --> 00:00:32,470 Now you've got short explanations next to his options some explanations arguably are a bit cryptic. 7 00:00:32,500 --> 00:00:38,770 Others are quite clear and I will say that a lot of these options most of these options will not matter 8 00:00:38,770 --> 00:00:42,760 in most project so you'll not set all of these options. 9 00:00:42,760 --> 00:00:43,930 Not even close. 10 00:00:43,960 --> 00:00:46,080 You typically can ignore a lot of these options. 11 00:00:46,090 --> 00:00:51,820 Now we'll pick up on the important options here throughout this course because some options only make 12 00:00:51,820 --> 00:00:54,130 sense when we learn about a certain feature. 13 00:00:54,370 --> 00:00:59,340 And I want to dive into some options right now already though and for that let's go through that file 14 00:00:59,350 --> 00:01:02,370 from from top to bottom and see what we got there. 15 00:01:02,370 --> 00:01:07,270 And let's start with the target option as you see this actually is set by default. 16 00:01:07,270 --> 00:01:15,160 It's not commented out and what you do with this option is you tell typescript for which target javascript 17 00:01:15,170 --> 00:01:21,490 version you want to compile the code because what types could does is it does not just compile new features 18 00:01:21,640 --> 00:01:28,600 like to type annotations that don't exist in javascript to JavaScript code so it does not just take 19 00:01:28,600 --> 00:01:33,430 care that this here works. 20 00:01:33,430 --> 00:01:43,090 It also compiles the code to javascript that runs in a certain set of browsers and you basically define 21 00:01:43,090 --> 00:01:48,970 which browsers support the compiled code by setting the target the default target here in this project 22 00:01:48,970 --> 00:01:55,300 as you see the initial target which is getting set up is iOS 5 which means all types of code is compiled 23 00:01:55,300 --> 00:02:02,080 down and we can actually see that if I run TSC here to compile all my files we see an app Yes I'm using 24 00:02:02,080 --> 00:02:10,410 let and const but an app J.S. we see var and that happens because we've got a target of iOS 5 and in 25 00:02:10,420 --> 00:02:14,380 years 5 a world we don't have let and concept. 26 00:02:14,440 --> 00:02:19,570 So the good thing here is that we can use typescript to generate code that works in older browsers as 27 00:02:19,570 --> 00:02:20,280 well. 28 00:02:20,650 --> 00:02:22,920 But it's totally up to us if we want to do that. 29 00:02:23,000 --> 00:02:28,030 Maybe we don't want to do that with typescript because maybe we got some other built tool that will 30 00:02:28,030 --> 00:02:32,830 then take care about the javascript translation and therefore we don't want to have types could do that 31 00:02:33,340 --> 00:02:39,610 or maybe we want to ship code that only works in modern browsers because we know our app only will run 32 00:02:39,730 --> 00:02:44,210 in modern browsers and therefore alternative options can be seen here. 33 00:02:44,230 --> 00:02:50,270 If you delete the value and then here in V as code at least if you had control space to get the auto 34 00:02:50,270 --> 00:02:56,450 completion you see a bunch of suggestions and you'll see all available values here. 35 00:02:56,460 --> 00:03:01,960 Now over time this of course will change because we got new jobs come to worship it's released. 36 00:03:01,960 --> 00:03:04,230 You saw we set this two years five before. 37 00:03:04,270 --> 00:03:10,330 If you don't specify target at all then right now typescript compiles to e is free even so it supports 38 00:03:10,330 --> 00:03:16,540 an even older version but you can also go with iOS 6 which is more modern which for example supports 39 00:03:16,540 --> 00:03:24,840 constant let or take a even more recent version iOS 6 is the equivalent to iOS 2015 just for the record. 40 00:03:24,940 --> 00:03:31,260 So if we set this to iOS 6 for example and I rerun the T S C command after changing that he has conflict 41 00:03:31,260 --> 00:03:38,200 JS to file you will see that now in app chase we got led and const because now that is supported there. 42 00:03:38,200 --> 00:03:46,000 So that is up to you of course the more modern of a javascript word and you pick here the more concise 43 00:03:46,000 --> 00:03:52,210 your generated code is because typescript has to compile less and less code or it has to work around 44 00:03:52,570 --> 00:03:58,720 non existing features in less situations and therefore the compiled code typically is then more concise 45 00:03:58,720 --> 00:03:59,580 and shorter. 46 00:03:59,620 --> 00:04:01,180 So that's the target. 47 00:04:01,180 --> 00:04:02,440 What about the other options.