Change language

TypeScript Beginner Tutorial 1 | What is TypeScript

Python functions
TypeScript Beginner Tutorial 1 | What is TypeScript

Hello and welcome I am Raghav from automation step by step and in this session and in this series we are going to learn typescript from scratch from the very basics so this is for complete beginners and I will teach you typescript step by step from scratch and do not worry if you have no prior experience with programming or with typescript I will show you all the Demos and examples and you can follow along me with hands-on so lets get started and first let us see what is typescript so typescript is a open source programming language from Microsoft and it is a superset of JavaScript so it is not a completely new programming language it extends JavaScript by adding some features and some functionalities that we are going to learn so typescript extends JavaScript by adding types let me show you this will go to my editor now do not worry I am going to show you all this environment setup and IDE in the coming sessions but just for now to show you a very very basic difference I am going to create a JavaScript file and I will name this as basic.js so I just created a JavaScript file with the extension.js and here I am going to create a variable and in JavaScript we use var and I will say x = 10 so I have created a variable X and have given the value 10 which is a numerical value now if I say X = and I give another value which is a string value and you can see there is no error so there is no issue here I can still do this but suppose if this is typescript let me create a new file and this I will called as basic TS So TS is the extension for typescript and now if I just copy the same code here I will copy this and put it in my typescript file here and here you can see I have got a red line here under X so if I hover it says type string is not assignable to type number so do you see typescript has types and that is how it adds that types to JavaScript and this is just starting you will see a lot of features and as I have said typescript is a superset of JavaScript so it is not a new programming language and it eventually compiles down to plain JavaScript and we also say it transpiles down to plain JavaScript because it is not a new language and if you already have a JavaScript file on a JavaScript code you can convert it into a typescript code and the advantage is typescript validates the JavaScript ahead of time because as you have seen here it is telling me even without running and before running my code that there is some issue here in JavaScript we have dynamic typing that is the types are resolved at run time when I run this code then it will check if there are any type issues but in typescript all this is done before hand so that is a main advantage of using typescript and now if I say why to use typescript then we have already seen that it is an extended JavaScript if you are already using JavaScript then we do not have to learn a new programming language and even if you have not used JavaScript still you can use typescript and you can work with your JavaScript code you can just rename a.js or a JavaScript file to a.ts or typescript file that is optional static typing and type inference so here we have seen this is optional typing the reason I say optional this is something we will Discover in the coming sessions and inference means as I have given the value here x = 10 so it has inferred that X is of type number and therefore it is not allowing any non numeric value for X so JavaScript is dynamically typed that is the types are resolved at runtime where is typescript is optionally type and it at the type support to JavaScript errors are identified even before you run your code during the compilation time it also adds Intellisense and code completion and this is because now we know that X is a number so as I will say x dot it will give me all the code completion and intellisense for the number data type of JavaScript so therefore we have a very good support in terms of Intellisense and code completion and therefore it makes our code more efficient and less error-prone you can all also go to the website for typescript so if I search for typescript you can go here typescript lang dot o r g and this will show you all the details you can see typescript extends JavaScript by adding types and it says you a lot of time as it Catches all the errors and it is open source and here is typescript validates your javascript ahead of time all this you can see here and in the coming session we will start with the environment setup we will select the ide and start learning typescript I hope this was very useful for you if you have liked this video please hit the like button and also subscribe to my youtube channel I will see in the next session thank you for watching

Shop

Gifts for programmers

Learn programming in R: courses

$FREE
Gifts for programmers

Best Python online courses for 2022

$FREE
Gifts for programmers

Best laptop for Fortnite

$399+
Gifts for programmers

Best laptop for Excel

$
Gifts for programmers

Best laptop for Solidworks

$399+
Gifts for programmers

Best laptop for Roblox

$399+
Gifts for programmers

Best computer for crypto mining

$499+
Gifts for programmers

Best laptop for Sims 4

$

Latest questions

PythonStackOverflow

Common xlabel/ylabel for matplotlib subplots

1947 answers

PythonStackOverflow

Check if one list is a subset of another in Python

1173 answers

PythonStackOverflow

How to specify multiple return types using type-hints

1002 answers

PythonStackOverflow

Printing words vertically in Python

909 answers

PythonStackOverflow

Python Extract words from a given string

798 answers

PythonStackOverflow

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

606 answers

PythonStackOverflow

Python os.path.join () method

384 answers

PythonStackOverflow

Flake8: Ignore specific warning for entire file

360 answers

News


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

How to specify multiple return types using type-hints

Printing words vertically in Python

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically