TypeScript Essentials: Functions & Objects | What is TypeScript?
TypeScriptTranscript
English (Auto-generated)
you know, it is javascript, you know, back and you know, behind the scene, you're doing javascript, but absolutely in a better manner is why it is, I mean why it's needed when, you know, you're not working on something different or a new language, you're ultimately working on javascript, you need to know that when you're on typescript, you're ultimately on javascript, but why then we need typescript actually, you know, um the the typescript has everything we have in javascript, but something more than the javascript. So this is why we uh we use the javascript, it has the inheritance, it has the proper, you know, object oriented programming, it is static type language. So these are the things, I mean, let's just talk about why somebody started working, you know, on the on the typescript, I mean why anybody started working on typescript when we have javascript, What was the problem? So actually, the, you know, the typescript was actually originally launched in the lab of Microsoft. So it was initially, it was their, you know, personal projects. So they were doing it like, you know, For their own system and their own setup. So they exactly created it when they were working on some big project anyway, the Microsoft is a big, big company. So I do believe that every next project of them is a big project, but anyway, they were working on some big project back in 2010 and they used a lot of javascript and then they realized that because of javascript, their codes, we're getting complex, complex and complex and and at the end of the day the code, you know uh started doing problems so you know, uh in in a giant sized big applications, absolutely uh the code can mess it up, you know, in in normal big applications the code can mess up, but when you're talking about a company like Microsoft, so absolutely uh it's, they must be making something giant sized. So they started feeling that the javascript is awesome but you know it's messing things up now because because of the dynamic type, you know, writing, so this is why the name of this language, this actually you can say the language but it's not the language, it's a super set of javascript. So they created javascript, they just created typescript. So you can say you can see that the in the name of this type. So the great thing, I mean, you know, we're a big application becomes weird or we start behaving weird for example, um we declare a variable in javascript, simple in simple language and simple manners, we declare a variable in javascript. So in in javascript, in any language we can modify unless it's a constant, we can modify the, you know, the the data of the variable. So absolutely it was possible in javascript to and it is possible in javascript to but because of the dynamic language, there are many dynamic dynamic language is already like PHP in a lot. So um PHP is, it is a totally different type anyway, it is a different kind of language anyway. So in, you know, you can change the data but you also can change the type. For example, you initially created a variable, the variable which was, you know, for example, this is a variable. Just consider it a variable, the variable and then the value is Angela here. But later you not only can modify the data, but you also can modify the type. You can right here. 123, I mean you can make this, this is in a string variable now, but you can make it entered, just telling you this is an object, not a variable. I was just taking the data hypothetically anyway, you can make it, you know, you can, you this is the string type data data for now, a string type variable for now. But later, when you modify you can change it into into, you can change it into bullying, you can change it into null or you know, undefined or whatever. This has started creating huge problems because you know, when the type collapsed absolutely, you know, if you put number into a string form, you just cannot, you know, multiply or do anything with the intent to get numbers. So in, you know, in in, you know, small applications, this is okay. But changing the type is a big problem when you're creating a big application, you know, because later, if you just simply forgot the actual type and now you're going with the different types. So you know, maybe it can work for, you know for a certain level, but after that it starts creating problems. So this is the solution of typescript mainly. So I think I've defined it a lot but by the way um you know you need to define the type of each variable at the time of declaration, this is one thing, but um there is a few more things like you know, it makes the the the the coding more readable, more documented. So now you just you know, it makes less chances of you two stuck at any point in a big application because now you have documentation whenever you create a variable, you're creating the documentation for example, you're defining its type. So absolutely, this is what we call, you know, the uh the the documentation. So this is why it is great. So there are a few more things, I mean it's a strong language, it has uh it got very popular when Microsoft made it uh made it public and uh excuse me. Yeah, um it's more pretty predictable because you know, when you write code in the typescript, if you do anything wrong, it has a great intelligence because you know, intelligence were was defined by Microsoft, if you know, if you have worked with the previous, I mean old languages of Microsoft like visual basic and different languages. So it is, you know, it's predictable, it's readable and absolutely when you have a documented and well documented coding. So it's very easy to you know find out errors because the errors in the typescript are not real time. It's you know when you you start writing the code the code and you're you know code editor itself shows you the error and simply puts a green a kind of line, you know green line or red line according to your you know theme you set for in your you know in your your I. D. But it shows a kind of line at the error. So things like that. So absolutely these are the very great and very interesting benefits but you know a few kind of cons there also exists for example you know it needs a compiler. So when you write in typescript now the compiler party is also interesting when you write in typescript, the browser cannot simply understand the typescript. So what you do in that case because when your browser just cannot understand typescript you have to use some compiler before using or before going live with the typescript. And that compiler converts the program into javascript. Now when you code in typescript, the javascript coding becomes you know not understandable for you. If you were you do a lot of work in typescript and then you would start understanding how important the the typescript and and the greatest impact in your life with the typescript because of you know it's understandable. Itty. So anyway enough with the you know, basic introduction of the typescript now I think it's time we move on and we do something more creative and more interesting with the typescript from the next cast until then stay tuned.