So as I mentioned in the last lecture watch mode is a great start.
But what if we have more than one typescript file.
What if we all have analytics start T.S. file where we hypothetically send analytics data to our server.
Now here to just have anything in there I'll just put in the console log statement.
But of course you could be sending H to the p requests to your analytics service here as I said.
So let's say we also did import this file here in our engaged him file.
If we point at analytics dot J as here which does not exist yet but which will exist after compilation
then we could be loading these two files and of course we want to compile both files whenever one of
them changes.
Now for that it would be nice if we could enter some general watch mode where we just run TSC like this.
So without pointing out a file and it just watches our entire project folder and recompile as any types
could follow that might change well turns out that this is possible for Dad we just need to tell typescript
that this year is one project dad should be managed with TypeScript and we do that by first of all.
And we only need to do this once running TSC dash dash in it.
So I'm not pointing at a specific file here.
I just run TSC and then dash dash in it here and again this is only required ONCE IT will initialize
this project in which you run this command as a typescript project.
That means it will now basically tell typescript that everything in the folder where you run this command
and therefore it's important that you navigate it into the right folder before you ran this command
with the built in terminal here in V as code I'm automatically in this project folder where my files
are.
So that this project is now managed by Hapgood lets it enter and what this does is it creates this as
conflict adjacent file.
This basically is the indicator for typescript bad the project in which this file lies and all sub folders
of this folder should be managed by typescript.
Now if we have a look into this file we see there are a bunch of options.
Most of them are common that out there just errors so that you see that you could set them and you've
got a short explanation here as well but we don't have to worry about those right now we'll dive into
them in a second.
For the moment let's just close this file here and let's see what this gives us because what it does
give us is that we can now run just TSC like this without pointing at a specific file and what this
will do is it will tell typescript to go ahead and compile all typescript files so all dot t is files
it can find in this project if I hit enter year you see this takes a while and now what we got is this
analytics Dutch js file and does app J.S. file.
Now the analytics jazz file was just created by typescript because it found that we have the analytics
of T file and as I said it will now compile all types of files in the project.
And of course this can all be combined with watch mode.
You can run TSC dash w or dash dash watch as I showed before and this will now enter watch mode for
all types good files.
So now whenever I change one of them and I save it it will recompile and it will recompile that file
that changed and therefore all the reflect the change in the javascript file and hence.
Now here if I go back to my page we see sending data here as well because now the analytics t as file
was also compiled.