So now did we have a understanding of how we can manage our files with the compiler.
Let's dive into the compiler options because that's really interesting.
This allows us to control how our types could code is compiled.
So not only which files but also how the files which are getting compiled are treated by typescript.
And there you see we have a bunch of options.
Now you've got short explanations next to his options some explanations arguably are a bit cryptic.
Others are quite clear and I will say that a lot of these options most of these options will not matter
in most project so you'll not set all of these options.
Not even close.
You typically can ignore a lot of these options.
Now we'll pick up on the important options here throughout this course because some options only make
sense when we learn about a certain feature.
And I want to dive into some options right now already though and for that let's go through that file
from from top to bottom and see what we got there.
And let's start with the target option as you see this actually is set by default.
It's not commented out and what you do with this option is you tell typescript for which target javascript
version you want to compile the code because what types could does is it does not just compile new features
like to type annotations that don't exist in javascript to JavaScript code so it does not just take
care that this here works.
It also compiles the code to javascript that runs in a certain set of browsers and you basically define
which browsers support the compiled code by setting the target the default target here in this project
as you see the initial target which is getting set up is iOS 5 which means all types of code is compiled
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
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
years 5 a world we don't have let and concept.
So the good thing here is that we can use typescript to generate code that works in older browsers as
well.
But it's totally up to us if we want to do that.
Maybe we don't want to do that with typescript because maybe we got some other built tool that will
then take care about the javascript translation and therefore we don't want to have types could do that
or maybe we want to ship code that only works in modern browsers because we know our app only will run
in modern browsers and therefore alternative options can be seen here.
If you delete the value and then here in V as code at least if you had control space to get the auto
completion you see a bunch of suggestions and you'll see all available values here.
Now over time this of course will change because we got new jobs come to worship it's released.
You saw we set this two years five before.
If you don't specify target at all then right now typescript compiles to e is free even so it supports
an even older version but you can also go with iOS 6 which is more modern which for example supports
constant let or take a even more recent version iOS 6 is the equivalent to iOS 2015 just for the record.
So if we set this to iOS 6 for example and I rerun the T S C command after changing that he has conflict
JS to file you will see that now in app chase we got led and const because now that is supported there.
So that is up to you of course the more modern of a javascript word and you pick here the more concise
your generated code is because typescript has to compile less and less code or it has to work around
non existing features in less situations and therefore the compiled code typically is then more concise
and shorter.
So that's the target.
What about the other options.