Hello, everybody.
All right, so in this lesson, we're going to start using TypeScript and quickly move into typescript
basics.
It's now, my friends.
First of all, we'll need to install typescript onto the computer via NPM and for this all over the
command line and type NPM install G typescript.
Run this command.
And after the installation is completed.
You can check which version was installed by running the TSC Dash Dash version command.
So in our case, this version has been in stone and we've completed the installation process.
Now, before we get into the code section, I want to create a folder on the desktop for typescript
studies.
And I'll open a visual studio code.
And here, I'll get to the final tab and click, and in the section that appears, I add the typescript
file on the desktop by saying and folder.
Now, add a new file with.
This tax extension, just by saying new file in this folder.
And in fact, whatever, Ed, you use, the operations that we do will generally be the same.
Creating a new folder, opening new file for it, or you can continue without creating any folders,
but I always think it's important for order.
So therefore, I will continue by creating new folders for each section in general and.
OK, so now that that's done, let's start writing code and our file.
Now, define a simple method and console will print the parameter that we've given.
First, print the parameter we give, then the word world.
And now we can define our variable with let code.
Then call the method with this variable.
So now here I want to show you.
So here, look, if if we want to in JavaScript, we can define this variable as a string value or a
number or an array, and we will have no absolutely no problems.
But in typescript, if we define the value that our method will receive as a string and then.
Give a number, we're going to get an error here right before we run it, we can see a problem with
our code.
So that means that you can get in a little bit more with TypeScript.
Just one of the benefits of TypeScript.
So we've prepared our file.
So now this file needs to be run.
So what do we say?
It's extension files need to be compiled first and we need to convert them to JavaScript files in order
to work in the browser.
So I will open the terminal and I'm running typescript compiler by typing, see?
And I'll write the file name.
As you can see, when we run our code, a new file is created with the same file name, but with a JSA
extension.
All right, so when we look into it, what's the difference between these two files, we see the delete
code that we made just for the variable definition has changed and turned into var code.
Important.
An hour file can be run easily.
So what do you think we can now see the value that we want in the console?
Sure enough, my friends.
We have met TypeScript in a very simple way, and in the next lesson, we're going to talk about data
types.
All right.
So see you then.