So this is now how we can manage multiple files with typescript.
Now one word about having multiple files when you work with multiple files as we're doing it here.
You can also import them into each other with modules which you might know from Manila javascript.
Here we have modules as well.
It is something I'll cover in a dedicated section of this course though.
So for now we just have two files which are not imported into each other but which are instead imported
into index h to.
Now with that out of the way though we know that we can manage this as a project and then we can compile
multiple files here.
Now let's have a look at the T conflict Jason File because this is a crucial file for managing this
project.
It essentially tells typescript how it should compile these files.
Now before we dive into the compiler options where we as the name suggests can configure how the compiler
behaves.
Let's scroll down to the place before the closing curly brace but after this nested closing curly brace
and let's see some of the options we can add here which don't affect the compiler or the compilation
step behavior but instead how the compiler works with this project because there for example you can
set exclude option.
Now if you add exclude here that will be an array and what you can't enter here are paths to files which
should not be included in computation when you run TSC on the entire project.
So for example here we could say we want to exclude analytics teams from compilation.
Now of course this does make much sense here.
But just to show how this works if we do that we now rerun TSC and first of all delete analytics Chase
so that we can see if it is recreated.
If we now run TSC or TSC in watch mode you see no analytics chairs follows created the reason for that
is that we're excluding that file.
Now of course for this file this doesn't make a lot of sense because I typically want to include it.
But if you had a file that for some reason shouldn't be compiled you can't execute it like this.
You can also work with wildcards and for example if you had a file that's named analytics dot def dot
t s and you don't want to compile that you could say all files that end with Def not test should not
be compiled and you can do that by also adding an asterisk here which is a wildcard basically and now
types will ignore any files that have dot def or T S included.
You could also add asterisks asterisk slash here and that would mean any file with that pattern in any
folder will be ignored.
So these are things you can set up here.
The only thing I want to set up here and that is a setting you will often find.
Instead I want to exclude node modules.
And the idea here is that I don't want to compile any typescript files I might have inside of node modules.
Now node modules is that folder that holds all the dependencies we install here in packets Jason.
And the dependencies of these dependencies and therefore these are third party libraries we're importing
which we don't want to touch.
And if any of these libraries should ship some typescript code then we certainly don't want to compile
it.
It will just slow down our accumulation process and in the worst case it might even break our project.
So therefore it's quite common to exclude node modules here though I will say if you don't specify the
execute option at all node modules is automatically excluded as a default setting.
So you don't really need to add this option here.
This would be the default.
I just want to show that excluding exists and how you could use it if the only thing you want excellent
is node modules you don't have to add the exclude key at all.
If you do add it though you should set node modules because otherwise it will not exclude that.
Now besides exclude.
We also have include and include allows it to do the opposite.
It allows you to specifically tell typescript which files you want to include in the compilation process
and anything that's not listed here will not be compiled.
So if a point at apt yes here you'll see if I rerun TSC we all will get no analytics t file or no analytics
J as file I should say.
Why.
Because analytics J is not included in include and as I said if we do set to include key then we really
have to include everything we want to compile.
So of course here we could then also add analytics tests here and with that addition we would start
and compile it as we see now we have the analytics chairs file or as an alternative we specify a whole
folder here which typically holds the files we want to compile exclude by the way if set alongside include
will filter down include.
So if we exclude some sub folder of a folder with that as part of include then that excluded sub folder
will be excluded.
So basically we compile include minus exclude.
Now of course here I don't want to set include I want to compile all types of files and therefore I
don't have to worry about that excluding node modules is all I need and as I explained theoretically
I don't even need to add that because that would be excluded by default.
Now we also have a files option.
This allows you to point at the individual files so it's a bit like include with the difference that
here you can specify whole folders what you want to include instead.
You really just specify the individual files you want to compile.
That might be option for smaller projects where you know you will only work with free files and for
some reason you've got a couple of other types good files which you don't want to touch though.
Then you can set the list of files like this.
In reality you might not need that setting that often though and therefore dates it with the basic compilation
or project management options here.
Now of course there is way more we can specify though way more we can specify about the compiler itself
and how it behaves during the computation step.