← Previous lessonFree lesson 3 of 3 · lesson 3 of 53

Unlock all 53 lessons of Angular Web Development for the Real WorldFull course ₹40,000 · paid

Price & syllabus
Free lesson · 51 min · no payment

What Angular Is, TypeScript Basics and Week 1 Summary

A free lesson from Skill-Lync's Angular Web Development for the Real World course, on Grow by Skill-Lync · Last updated 16 Nov 2026 · Session: “Week 1 Session 3”

What will you learn in this free Angular Web Development for the Real World lesson?

The lesson introduces Angular as Google's open source framework that follows the MVVM pattern with two-way data binding. It then explains TypeScript as a compiled superset of JavaScript, shows it in an online playground, and summarizes the week.

  • Angular as an end-to-end web and mobile framework
  • Two-way data binding in Angular
  • How TypeScript compiles to JavaScript
  • Catching errors with TypeScript before runtime

What comes after lesson 3?

Later in Skill-Lync's Angular Web Development for the Real World course (paid): lesson 4, Week 2 Session 1; lesson 5, Week 2 Session 2; lesson 6, Week 2 Session 3. The full course has 53 lessons (25 h 59 min of video); see the course overview or its price and syllabus.

Lesson transcript

Machine transcript of the lesson audio (lightly cleaned). Technical terms may contain errors; the video is the reference.

Welcome back of the Angular web development course. In this session, we try to understand what is Angular on a high level. So to start with, what is Angular? As we discussed earlier, Angular is a web and mobile application development framework which is developed and maintained by Google. So as you know that framework is something which provides you an end-to-end solution for your complete development experience right from starting up your application or creating the project till it gets deployed. So it provides you the end-to-end solution. So Angular is a free and open source web framework. What I mean by open source is that you can also contribute to the development of Angular if you are interested.

So in case you feel that you can enhance or write new features into Angular, you can go ahead and go to the GitHub repository of Angular and provide your contribution as well. And Angular is one of the top preferred web frameworks used across by many large and popular enterprises and startups across the world because of its simplicity and also offers the features that it provides. Angular provides an end-to-end ecosystem of tools which aids us with the development of screens, styling the pages, routing between the screens, managing data on the screen and other stuff.

As I said, since it's a framework, it provides us the complete end-to-end solution and we don't really need to bother about implementing each of these aspects by ourselves, but rather we can just simply use the particular Angular utility or tool that is provided and it will be available to us out of the box. And as we discussed earlier, Angular follows the MVVM model pattern of architecture instead of MVC, which helps in implementation of two-way data binding. And what is two-way data binding as we discussed earlier, two-way data binding is nothing but like, you know, the dynamic update which happens between your model and view dynamically as in and when any of these changes.

So any change to your model will update your view and any change to your view will dynamically update your model without any in-between intervention. So this is implemented using MVVM pattern of architecture, which Angular follows and using Angular, you'll be able to develop web application for both web and mobile application using a single code base. So what I mean that when you see using Angular, you'll be able to develop both web and mobile application. So if you remember from our earlier sessions, a web application is something which you access from the browser, whereas a mobile application is something which you access from your mobile, like as in an application which you use.

So using Angular, you can develop both applications for the browser and also you can also develop hybrid web application, which can be packaged and installed as a standard on application on your mobile as well. It can be your Android or iOS as well. And Angular internally utilizes TypeScript instead of JavaScript for implementing the view model related aspects. And TypeScript provides you additional features as compared to your standard JavaScript, right? And we'll be exploring more about Angular in the next class or the next week. And for now, we'll be focusing a bit more on what is TypeScript.

So now let's try to understand what is TypeScript, right? So we understood that what is JavaScript. JavaScript is nothing but like, you know, it is a traditional scripting language which is used for implementing any of the web application. And it has been around for quite some time. So what is TypeScript now? So TypeScript is nothing but a superset of your JavaScript of the ESX or a 2015 version of JavaScript. And just to let you guys know, JavaScript is professionally maintained by a committee called ECMA, ACMA.

So every year or every, like, you know, once in a while, they release an update to the JavaScript and it is given a version number. Like the ES5, the ES5, it is called the legacy JavaScript. From ES6, it is called the modern JavaScript. So like every year, they release a new version to the JavaScript like ES6, 7, 8, 9, so on and so forth. So TypeScript is nothing but a superset of this ES6 JavaScript, right? So it is a full-featured, object-oriented programming language developed and maintained by Microsoft.

And unlike JavaScript, TypeScript is first compiled and then transferred to JavaScript for browser to understand it. So one important point to understand over here is any browser will be able to understand and execute JavaScript out of the box. What I mean by that is if you give a browser a JavaScript file or a JavaScript command, it will just interpret it and run it out of the box. But a browser won't be able to understand the TypeScript command. So in that case, what happens is when you write any code in TypeScript internally, first the TypeScript is compiled into JavaScript code.

Rather, I would say TypeScript is first compiled internally by the TypeScript compiler and then it is transpiled into JavaScript for the browser to understand it. So let's try to understand it from the whiteboard on what I mean by compile and transpile. So there are two parts of it, right? We saw something called compile and we also saw something called as transpile. So let's try to understand what is the difference between both of these. This is also an important interview question because you might be asked like, you know, what is the difference between interpreter, compiler and transpiler?

Okay, so either it can be interpret, compiler or transpiler or interpreter, compiler or transpiler, but the concept is same. Okay, so let's try to understand. First, we will get into JavaScript. So JavaScript, as you guys may know, is the interpreted language. Okay, so what do I mean by interpreted language? They assume like, you know, you have 10 lines of code. When you give this JavaScript file to the browser, your browser will not bother like, you know, what is the commands which are there at the end?

What it will do is it will just go line by line and execute it. So say on the line number one, if I have something called a is equal to one, on line number two, I have something called b is equal to two. On line number third, I have something called c is equal to a plus b. Then on line number four, I have say something called console log c. And say on line number five, I write some invalid code. Say like, you know, I say something like d is equal to e plus f, just for example.

So in this kind of scenario, what happens is your browser won't know there is an error at this line till it actually reaches this line. What it will do is when it sees the JavaScript file, it will execute it line by line. So first it will see a is equal to one. Then it will store in the memory that a is equal to one. Next it will see b is equal to two. It will store in the memory b is equal to two. Then it will see something called c is equal to a plus b.

Then it will like, you know, create a variable called c and just sum up a and b and make it three. Then it will see there's a console log. So in your console, it will print three. And then when it sees that, you know, d is equal to e plus f. And if like you use the strict mode, it will throw an error over here stating that, you know, neither d, e or f is kind of defined over here. Right. So one disadvantage in this approach is that you will get error only at the runtime.

Okay. So what I mean by runtime is when you code it, you won't see any error in your IDE or your whatever, like, you know, the coding environment that you do. But rather only when you execute it at the runtime and it actually reaches at this point, you will get the error. So that is called as runtime. Like, you know, when your application actually gets executed. So this is one of the, like, you know, disadvantage of using an interpreted language, most of the errors, such kind of logical errors, you will only encounter at the runtime rather than at the development time itself.

But one advantage of using interpreted language is that it is quite fast. But as you can see, like, you know, once the file is seen by the browser, it directly goes on line by line execution and execution is quite fast in case of interpreted language. So next, let's try to understand what is a compiled language. So next, let's try to understand what is a compiled language. A compiled language classic example would be Java. Right. So what happens in case of Java is when you write a Java code, right?

So initially your Java will, your Java JVM or like, you know, your Java will compile it into create compiled code of it. And that compiled code is then executed by the JVM in the target machine. So you have a Java application. Then your Java compiler would compile that into a compiled code. And that compiled code then gets executed on the target machine, which is nothing but your JVM. Right. OK. So in this case, what happens is basically I'll just give you a simple representation of it.

Say that, you know, you have application written in any language. Say, as you like, you know, you have written it in a language, say X. Right. So when you compile it, this gets transformed into a different pattern called Y based on whatever target platform or operating system that you have. And this in turn gets executed by your machine to show whatever logic or like, you know, whatever manipulations you have done. So when you compile a language, basically what it does is when you write any code, this is basically in a human readable form.

But when you compile it, it becomes into a machine readable format. Like it can be either a binary code or assembly code or whatever code that the underlying language uses. And that code then gets executed by your target machine to show whatever results you want. So this is what is a compiled language. Right. So the next thing that we have is called a transpiled language. Right. So what is a transpiled language and what is a transpiler? OK. So when I say transpiled, it applies to the language.

And when I say something like transpiler, it only means the tool that is used to perform this. So when I say compiled language and compiler, what it means is compiled language means basically the language which gets compiled. And compiler is nothing but the tool which is used to perform that operation. Right. So let's take the TypeScript for example. So when I say TypeScript is a transpiled language, what happens is TypeScript, as I said, it is a language which is nothing but a superscript or JavaScript. So when I write any code in TypeScript, right.

So internally first it gets compiled by the TypeScript compiler into the underlying code which it produces. And then finally before it gets shipped to the browser, it gets transpiled into JS, JavaScript file. Okay. Okay. So what happens is, let's try to understand this. So say like, you know, I write just a simple program, like, you know, I just try to implement some TypeScript program for say, like, you know, to implement a program. Call Calculator, for example. So first the TypeScript will compile it just to check if there are any logical errors or like, you know, any simple programmatic error which can be caught at the development phase itself.

And if it finds that, it will flag it and, you know, it will like, you know, let the user know. And once it passes all that check, finally before shipping to the browser, what it does is, it will transpile it to the corresponding JavaScript code. As we know earlier that TypeScript is a superset of JavaScript. What it means is, so whatever feature JavaScript provides, TypeScript provides that. And on top of that, it provides a few additional features. But these few additional features may not be understood by your browser. See, for example, TypeScript provides you something called as interface, right?

But your browser will not understand what is the interface and how to manipulate it. So in those kind of scenarios, what happens is, TypeScript will internally again, like, you know, structure it back into objects or like, you know, data structures which is understood by your JavaScript as so that your browser is able to destructure it and execute it on the browser, right? So this is what is the concept of transpiler. So coming back to the slide. So, yeah, so TypeScript is first compiled and then transferred into JavaScript for browser to understand it, okay?

So the next point is TypeScript is statically typed and supports strong typing, okay? Now let's try to understand what is the meaning of this. What is statically typed and what is strong typing, okay? So coming back to the whiteboard. So what is statically typed, okay? So if you know JavaScript a bit, so how we declare normally variables in JavaScript is, we directly give something called like, you know, where a is equal to 10 or say, let b is equal to say hello, something like this, right?

So in traditional JavaScript, you will see that, you know, there is no way wherein I can assign what data type my particular variable can take. So what I mean by that is, if I declare here like where a is equal to 10, still I can further down my program, I can change the data type of this 10 and I can say here, hi, right? This is still a valid JavaScript, though I am changing the data type of my variable, okay? This is allowed, but there is a problem to this is, say like, you know, this a is, should only contain numbers, say for example.

But in case, like, you know, the user goes, the developer goes in and changes the data type, there may be chances that, you know, it can even break the application. We will see an example of it down the line, but for the time being, just understand that, you know, if you don't have a statically typed language, what happens is like, you know, you won't be able to assign the data type to particular variables in your program and that might cause some logical issues down the line.

And what is strongly typedness is, now say, assume like, you know, in TypeScript, if I have given a data type to a particular variable, say like, you know, I define that, you know, a should only be a string. And I assign it something called high, okay? So in this case, what happens is, if I try to assign a some other non-string values, say for example, I just give it a boolean like true or I make a, I give a some number like 100, okay? So in this kind of scenario, the compiler will throw me an error stating that, you know, a is defined as a string, but you are giving it some other value.

We'll see this in real time in just a few minutes, but for now, just understand that, you know, when I say statically typed, it means that, you know, the program gives me an option to assign a data type to my particular string. And when I say it is strongly typed, it will strictly check, like, you know, whatever is the data type assigned, only that value is being assigned to that particular variable. So that is the concept of statically typed and strongly typed. So coming back, TypeScript also supports some new concepts.

So as I said earlier, like, you know, it gives you a few enhancements over JavaScript, like interfaces, enumerators, which are not natively supported by ESX or JavaScript. I'd also understand one thing that interchangeably, JavaScript can also be called as ESX, ECMAScript 2015 or ESX Plus. So all these are nothing but an alias to the JavaScript name. But the another advantage of TypeScript is that the syntax of TypeScript fairly matches the JavaScript. So you don't really need to learn some new syntax or some very new language from the scratch.

So if you are already familiar with JavaScript, which is a prerequisite to this course, you'd be fairly able to pick up TypeScript in no time. OK, and also being object oriented, it is fairly easy for people from Java, .NET or Python background or any other language background to pick up TypeScript quite easily. Because JavaScript, as you may know, does not really support OOPS concept from this out of the box. But TypeScript supports OOPS paradigm as well out of the box. So now let's try to jump in and understand, like, you know, why we require TypeScript, what are the features of the TypeScript and, you know, those kind of things.

So for that, what I will do is I will first, like, you know, walk you through a simple JavaScript program, wherein we'll try code just a simple JavaScript program, which sums up two numbers. I will show you what is the problem with that and we'll try to see how can we address that using TypeScript. OK, so let's jump in. OK, so now what we'll do is we'll just write a simple web application wherein we'll try to take our two user input and sum it up and show the output to the user.

OK, let's define a simple HTML. So we'll just save our code that we written as a HTML file. OK, so I'm just saving it in my desktop as index.html. OK, now let's try to see what happens, right? So assume like, you know, we'll first tell you what is this application about. OK, we'll just see the code first and then try to understand what is happening. So this is just a simple HTML code with a JavaScript just to let you know, like, you know, we are just trying to just sum up two numbers with the user enters.

And whatever is the output, we are just giving it back to the HTML, right? And to make that summation and display back the result, we're using this sum function over here, which will just take the, like, you know, the input value from these two input fields over here, sum it up. And again, whatever is the result, it writes it back to this and with the idea of result, right? So now let's see what happens. So in my first number, I type something called like, you know, say one.

And, you know, in my second input, I type something called, say, maybe two. So what do you expect the sum of this would be? Like, logically, you think that, you know, one plus two, it should return us three, right? Like, I made a mistake, just need to add a way selector over here. OK, now when I execute it, OK, so, yeah. So as I asked you, like, as you like, you know, you just give it one over here and two over here and I sum it up, you'll be expecting three.

But if you look closely over here, right, it is not giving me three, but rather it is giving me a 12. So why does it happen? So as I said, JavaScript is not, like, you know, strongly typed language and statically typed language. So what happens is when you kind of like, you know, assign values directly from your input to a variable, this is interpreted as string by JavaScript and any string addition operation in JavaScript will just concatenate both the string and return you the value. So in that case, what happens is no matter what is the number I type, it simply just concatenates all of them and gives me output, right? So this is what I said, you know, it's kind of a logical error or issue that we have, like, you know, since JavaScript is interpreted and, you know, also like since it does not have the strong typing, what happens is like, you know, such kind of logical errors can creep in where you want the user to enter number and like, you know, it should be interpreted as number, but due to this limitations, it can like, you know, miss and give you some other output. So just to overcome these kind of issues, why is why we have TypeScript? So we'll try to understand like, you know, internally how TypeScript will like, you know, compile this into, transpile this into JavaScript to solve this issue, right? So let's, what we do is the same HTML code that we wrote, right now, we slightly modify it just to understand like, you know, how TypeScript will transpile and make this code better and implement the strong typing, right? So all I need to do in this case is, in your TypeScript, when you type as num1 equals to number, so what internally TypeScript will do is, it will just compile, like, you know, convert whatever value you're getting from this value to a number and the rest of the logic remains the same.

So what I've done right now is, by adding this plus is, all I'm telling the JavaScript compiler is, the interpreter is that, whenever you encounter any value from this particular input num, which is nothing but this input or your first input, you just convert it into a number before performing any operation. So in this case, what happens is, when I come back to my browser, and now I refresh it. So in this case, when I type, like, you know, any number, you would see that, you know, it is actually determining the actual value.

So this is what is the advantage of using TypeScript. You don't really need to bother about doing all this minor things yourself. So, in your TypeScript program, you just simply define the type of it, and internally, it will convert the JavaScript to this format, right? You will actually see how to write a TypeScript program, but this was just a simple demo for you to understand, like, you know, why is, do we require TypeScript in the first place? So after we did this conversion, now you can see that, you know, even we type any number, it automatically sums it up and gives us the actual value.

So, yeah, just to give you a flavor of why we require TypeScript, this is a sample JS program, which will help you to understand it, right? So now what we will do is, we will try to understand what are the features of TypeScript, and, you know, how you can learn TypeScript better, and all that thing. So before we go any further, I want you to know that, you know, there is some, there is a website called TypeScript lang.org. So you can just go to this particular website, this is kind of the homepage for your TypeScript, which gives you kind of a lot of walkthrough, and, you know, other information about the TypeScript.

There is something called the handbook, which you can go through in your free time, and there is also something called a playground, where you don't need to install anything of TypeScript in your local, and directly you can kind of, like, you know, play around with the TypeScript feature from your browser itself. I feel this is an, one of an important advantage of using playground, because if you want to try something of TypeScript on the go, you really don't need to, like, you know, install TypeScript in your local, which we will be doing in the next session.

But for now, we will be playing around with TypeScript features from this playground itself, okay? And also, there are a lot of examples given over here, like, you know, we will be going through this now, but, like, you know, if you want to just quickly check out, say, what is the enumerator, you can just click on enumerator, and it will give you a sample program. And, you know, if you just run it, it will just execute to you, and, you know, you can play around with that.

So, this is how is, like, you know, TypeScript works. And one more thing, as I said, since TypeScript is transpired into JavaScript, if you are interested to understand, like, you know, how TypeScript internally transpires to JavaScript, you can just click on this JS tab over here on the right-hand side, and it will give you the corresponding JavaScript program, which gets executed by your browser. So, this is just for your understanding, to understand how does the TypeScript, like, you know, converse any of these data structures into the corresponding JavaScript code, right?

So, yeah. So, with that said, now, let's try to understand, like, you know, what are the various features, and what are the various things which we need to understand about TypeScript. So, the first thing is, TypeScript can be, like, you know, you can write TypeScript programs in two ways. So, one, if you see over here, you have something called, try TypeScript now online or via NPM. So, what do you mean by via NPM or on the browser? It's okay. So, one thing, as I said, you can directly execute TypeScript from your browser using this playground.

Click on that, and, you know, this opens, and you can play around with it. So, this is one way of doing it. The second way, or the normal way which we do it is, we can also download it on the computer using NPM. Okay. So, if you guys are not aware of what is Node and NPM, I'll just give you guys a brief, like, a heads up on what is that. So, let's try to understand it using the wide node. Okay. So, what happens is, JavaScript, if you guys are aware, like, you know, JavaScript is predominantly used to write your UI code, right?

Or something that executes on your browser. Okay. So, this is where we predominantly use JavaScript so far. But, like, you know, back in late 2010s, like, the late 2000s and early 2010s and so on, what happened is, what, there was this increasing demand for converting JavaScript into a full stack language. Meaning, JavaScript can also be used to write API or server code. And to do this, there was something invented called the Node.js, which is nothing but, this uses the same JavaScript engine, which is used by the Chrome, okay, which is called the V8.

And using that V8, this Node.js now executes on a server so that using the same JavaScript language, you can write both your UI as well as the backend server or the API as well, okay? So, if you guys remember from the earlier session, UI is nothing but what the user sees on the frontend and server API is nothing but the actual middleware or the interface, which helps you to fetch the data or read or write the data from the database and bring it back to the UI, right?

So, earlier, what used to happen is, JavaScript was only used for the UI and for the server API, we used to use languages such as Java, .NET or Python or any of these server-side languages. But, just to replace all this, we had something called as Node.js, which used JavaScript internally and, like, you know, using that, we could write this API as well. So, Node.js is nothing but, you can see, is a runtime environment which provides you to, like, you know, execute JavaScript, okay? And, Node.js also has something called NPM, which is nothing but Node Package Manager, which means, Node Package Manager is nothing but you can just assume, like, you know, this just provides you a ton of feature or third-party libraries and frameworks which you can install in your project, in your Node-based project, okay?

So, what happens is, you can just think of it in this way. So, you can say that, you can think, like, you know, Node is the ecosystem, like, your developer ecosystem, which provides you NPM and using this NPM, you can install any packages in your project, okay? And, once your project is compiled, right, all this will get compiled into JavaScript files, which will be executed by your browser. So, this is how is the entire N2N workflow, okay? Yeah. So, coming back to our discussion, so, there are two ways you can, like, you know, install use a TypeScript.

So, one, as I said, is from your browser directly using Playground over here or you can also install it locally using NPM by this command, NPM install TypeScript. When you use Angular, you don't really need to do this step specifically because when you install Angular CLI, automatically, this is done for you in the backend. And, also, we will be seeing, like, how to install Angular in the next week session. So, for now, you can skip this part. What we will do is, we will directly get into the Playground and we will understand each, what is the each feature of TypeScript and how we can learn it, okay?

So, first and foremost, understand one thing, okay? Whenever we have, like, you know, TypeScript, right? So, as I said, TypeScript is first compiled and then transpired. So, if you don't need to, like, you know, run TypeScript in the browser and just you need to do some local testing and writing of the code, then you can use the node commands to do it. Like, you know, there's a command called TSE using which you can compile your code locally and run it, okay? And TypeScript also provides you something called a strict mode.

So, what is a strict mode is, like, you cannot assign any data type to any of the variable, okay? What I mean by that? Now, let's write a sample program and understand, like, you know, how TypeScript works. So, let's say, like, you know, I just do a console log of, say, some name. So, as I said, TypeScript also works like JavaScript. So, you can just write console.log mark and you can see that, you know, it log, console logs that word for me. Now, let's try to, like, you know, do some simple program using JavaScript, right?

And before that, let's try to first understand a few features of TypeScript. Okay? So, in TypeScript, basically, we first need to understand what are the data types that are available. So, in TypeScript, basically, we have seven data types, okay? Primitives or data types, what we call it, okay? So, what are these seven data types? One is the string. One is your number. One is your begin. One is your undefined. Next, you have null. Then, you have symbol, okay? So, these are kind of, you know, the seven primitive data types, which are also present in your JavaScript as well.

So, when you declare any. kind of variables, right? You can assign this any of these data types, okay? And also there is another way, like as I said, there can be scenarios where like, you know, you can have a variable which can also hold multiple data types, right? You know, for example, say I have variable name called, say maybe like, you know, just give it a random name called XYZ, okay? At some point of time, it can contain a string, at some point of time, it can contain a number, some point of time, it can be null, some point of time, it can have a boolean, so on and so forth, right?

So, in those kind of scenarios, what I can do is, I can also define it of the type any. So, what any does is, this will behave as a normal JavaScript variable. So, the user is free to assign any data type to this particular variable if I define it as any, okay? So, this is what we understood from the parameters. We have seven basic data types which are present in TypeScript, okay? And what I mean by boolean when I said earlier is, boolean is nothing but, you can either have as true or false. And remember that, you know, we don't write it as a string.

It is without this double inverted commas, okay? So, this is a boolean data type, okay? So, how we declare a sample variable in TypeScript is, so, like, you know, I can just type as, let, say, I give it a name called something like ABC or, like, you know, some variable name. I declare the type of it, like, say, string. Then, I can declare some value for it, say, like, mark, right? So, this is how you declare any variable in TypeScript. So, similarly, if I need to have, say, a number, so, I can do, like, let x, y, z of the type number, and I can declare it, and for number, I don't need the double quotes.

I can just give it, like, say, 1, 2, 3, okay? And similarly, and since I said this is a compiled language, right? So, let's try to see what happens if we try to give it some incompatible data, okay? So, now, say, let's, I give a, I declare a variable of the type of, say, maybe, boolean, okay? And as I said, boolean can only contain true or false, right? But what if, instead of true or false, I give it some name, like, say, maybe, ABC? You see that, you know, now my compiler throws an error. If you hover over this PQR, you see that, you know, the type string is not assignable to the type boolean.

So, in this case, what we need to do is, we just need to replace this boolean with any of the boolean values. So, you can either give it as true or false, and in that case, you see, now, this error is gone. This is one of the major advantages of using PaxScript. Like, if you make any logical errors, it will throw you the error right away. Instead of, like, JavaScript, where, like, you know, you might get some runtime error or logical issues, okay? So, this is one way of declaring the variables. So, now, next, we will see, like, you know, what if your variable can hold two or more data types?

So, one we saw is any, right, you know? So, if I declare a variable called, say, maybe, CD, E, CD, and if I give it the type of any, right? So, in this case, what happens is, I can assign CD any value. So, for example, I can give it, like, a string, then, next time I can declare, like, you know, I can assign it a number, the other type, I can just give it null, so on and so forth, right? So, this is the use of using any.

But, what if I do want to use any and just, I want to use multiple data types? So, in that case, what I can do is, here, simply, I just can give a union. So, I can just say, CD can contain either string or it can contain number or it can be null. So, what I mean by this is, I can have a variable called CED and, like, the value of this CED can only be of the type string number or null. So, in this case, as you see, since I have assigned CED only string number or null, it is allowing me to assign the value of CED.

However, if I, say, try to assign CED some Boolean value, right, say, like, false, you see that now, now, my interpretive compiler throws an error that type false is not assignable to the type of string number of null. So, this is how we, kind of, can assign multiple data types to a variable. So, this is what we called as a strongly type and statically type language, right? You can define what data type of that variable can be and assign the values accordingly, okay? So, the next thing that we can understand is, we can also define your own custom type.

Say, for example, you are writing some applications where you know that your variable can only contain some particular values, okay? Say, for example, like, you know, you are writing a shopping cart application, okay? And where your shopping cart data type, the status of your shopping cart can be only two. Either it is filled or it is empty. So, in that kind of scenario, you can define that values as well. So, yeah, something like this. So, I can say that, you know, yeah, I can define something like, you know, my, define a variable called cart status and I can tell that it can be only of the data type filled or empty.

So, what I mean by that is, when I have, like, you know, in my program, if I do some manipulation and, like, you know, after that manipulation, I have to store some value to just cart status. Then only I can store two values, either it can be filled or it can be empty. But if I try to kind of like, you know, give some other value to it, say, for example, if I try to give it one, two, three, it will throw me error because this cart status can only contain two data value, which is either filled or empty.

So, this is another way how you can define some custom values, which only you can assign to a particular variable, right? So, this is so-called as literal types, okay? So, the next is, we can also define objects in TypeScript. So, what we can do is, we can define kind of a interface or first we'll try to understand what is, how can we define an object in TypeScript. So, object is very simple. So, let's assume, like, now, we'll create an object called Student. So, Student can have Need, which would be of type Spring, and a student can also, like, you know, have something called as a Rule Number, which would be of the type Number, right?

So, yeah. So, this is how, like, you know, we'll come to this part. There's something called a concept of interface, which will be touching this. But, just assume, like, you know, in your program, you have, you will, like, use a lot of object, which will follow this template, wherein, like, you know, you can have a Student object, wherein you'll have two data. One is the name, which will be of the type String, and the second would be the Rule Number, which would be of the type Number, right?

So, assume, like, you know, now, I need to make this kind of a template or, like, you know, kind of a default rule, which all my Student object needs to follow. How can I do that? So, for that, there is something called as an interface. Okay. So, what an interface does is, basically, an interface is nothing, but it kind of is a, you can say, like, you know, it describes the object properties. So, you can describe any object and what are the key and value data type of that key, which can it contain.

So, what I can do over here is, so, the next time I define some data, which is of the type Student, say, like, you know, I type something like Student1, which is of the type Student. Which is of the type Student. Okay. The Student interface. So, we need to declare it. Yeah. So, when I do that, now you see that, you know, if I have not typed anything over here, my compiler throws an error that, you know, I need to fill it. So, let's give it some name.

Yeah. So, as you can see over here, right? The advantage of using an interface is that we can define a template of a particular object where we can say that, you know, anytime we encounter a student or any kind of these standard object, it should have these particular data and this data should be of this particular type. Right. Right. And I try to assign it some name, say, like, Angular. So, in this case, you will see that, you know, it throws me an error because this is not part of my interface, right?

And one more thing about your interface is that you can also give optional data in your interface. Say, for example, there may be scenarios where your student is present, but he or she is not enrolled in any course. So, in that kind of scenario, what we can do is we can define an optional data as well. So, say, for example. Okay. So, here what I have done is I have defined the optional data called what this question mark means is it's an optional data. Okay. So, I have defined an optional data called ease and route and it's of the type Boolean.

So, what I can do is if I define a student one without this student role, it will still allow me because it is an optional data. And similarly, if I need to, like, you know, create another student, which is having this is central, I can still do that. So, in this case, I just need to create another student and here I can just, like, you know, add that is central and give it a true value. So, in this case, this is also a valid object, right?

So, this is how is what is the use of interfaces. Okay. So, the next thing that we need to understand about TypeScript is the concept called a tuple. Okay. So, what is the tuple in TypeScript is? It is nothing but just it's a special type of array with fixed size and known data types. Okay. So, you can say it is. More like a stricter type of array. So let's try to understand how it works. So say like, you know, I have something called like, you know, like say like I need to have an array of say maybe like products in my shopping cart, right? So the product strictly has to be of the type string. So what I can do is I can define something called as cart items, which can be my tuple name and I can define an array and I can say like, you know, what would be the kind of objects which can be stored in it, like the data type.

So I have to say it can only be of the type string string. Okay. So now what happens is the next time I go and, you know, I try to add some items to it. I can only add products to like string items to it. So I can say like, you know, maybe like apples. Yeah. So now if you see, right, what happens is first I define my cart item can only contain two objects and both of them would be of this type string. And now what here I did is I added three items. Okay. So that's why you see my compiler is throwing error. Okay. So how to fix it is if I just remove this right, my compiler automatically like, you know, now executes fine because this is what is the concept of tuple.

So what is a tuple is? So basically I'm just giving a fixed length array and I'm also defining what is the data type that it can contain. So that this is basically used as scenarios where like, you know, you want to enforce a stricter version of array and array. I hope you all know is this is what is an array. Right. It's just a list of objects in a sequence. Right. The next important concept which we need to understand in TypeScript is the concept of enums or enumerators.

So what is an enumerator? Enumerator is nothing but it's just a set of related values and it's kind of a descriptive constant. Okay. So let's try to understand it. Say like, you know, I need to know flight status. Okay. So I can define enumerator like this. So I can just say like enumerator and I can define what are the values this flight status can contain. Okay. So this flight status can be on type or it can be scheduled. It can be like, you know, departed or it can be delayed.

Okay. So just assume like, you know, these are the values which my flight status can contain. Okay. So this can be implemented using the concept of enumerators. Okay. So what enumerator basically does is you can define kind of a template which and define like what are the various values this can contain. So now what happens is if I do flight status dot on type delete, say for example, it will tell me like, you know, what is the index position of this? So say delete over here is 0, 1, 2, 3. So the index position of delete is 3. Right. And similarly, like, you know, if I just do flight status dot, it will just determine what are the allowed values of it.

So where this is useful is, say like, you know, you need to have some logic or you need to have some validation. You need to ensure that, you know, only it gives you some status, which is expected by the application, not something else. But those kind of scenarios, you can use enumerators over here. Okay. And yeah, with that, I think we have covered most of the basic TypeScript features, which is required. We'll also will be covering other TypeScript features as we go deeper into Angular. But I think for now, this introduction is more than enough. And for your information and, you know, for your further hands-on information, what you can do is you can get go into this TypeScript lang dot org and just go through this handbook here.

So there is a link called handbook over here. You can go through this and you can understand TypeScript even better in your free time. Okay. So with that being said, let's try to now write a simple TypeScript program and we'll see how to execute it. Okay. So let's take a sample, simple TypeScript program. So what I need to do is, so assume like, you know, I want to take in a letter from user and determine whether it is a vowel or not. Okay. So how can I do that? So I've just defined what we are going to do over here as a comment.

So let's try to do this in action. So first, what we will do is we will take the input from the user. Okay. For this, we can use the browser's prompt. Okay. In JavaScript, we have something called the prompt method by which you can take the input from the user. So how can we take the input from the user and assign it to a string? Let's see that. So if you know, basic JavaScript, we just use the basic JavaScript features over here. So let's try to understand why we got the error over here and how we can resolve it. Okay.

So understand what is happening over here. So when I, if I just hover over this letter, it is telling me that type null, string or null is not assignable to the type string. Okay. Okay. So there are two ways to fix it. Either you just make it string or null. Okay. So that will fix over here. But if you see that, you know, it now throws me an error over here telling that null is not assignable to the type string. Right. So in this case, what we need to do is we have to tell the TypeScript to ignore this if it is null.

And for that, the best way to do is at the end of this, like, you know, whatever assignment you do, just add an exclamation mark. So with this exclamation mark, you're telling the TypeScript compiler that even if this value is null, you can ignore it for now. When the user provides the actual string value, you can proceed with the execution. Right. The next, what we are doing is, as I said, enumerator is a feature in data TypeScript where you can define a predefined set of data, which can be used for validation.

Now, as you know, Wobble has a predefined set of characters like A, E, I, O, U. So what we have done is we have defined this Wobble as an enumerator. And since Wobble, like this enumerator, acts as an object, so what we have done is we have just iterated the value of that object using this Wobble variable. And now what we are doing is we are just trying to see if this Wobble has any of these values, which is being sent by the user. And what is this question mark and semicolon, this colon doing over here is, it is nothing but just a ternary operation that we do in the JavaScript. Right.

So basically what we are doing is we are evaluating this. We are checking if like, you know, this operation is a true or false. If it is true, then we say it is a Wobble. If it is not true, then we say it is not a Wobble. How we say it is true or false, it simply means that, you know, if the user enters any of these A, E, I, O, U, then this includes will return you that index position, which means it is letter is present.

If not, it means that it is not present and which means it is not a Wobble. So let's now try to kind of like, you know, run it in action and see how it works. So to run it, all you need to do is just hit on this run button. You see that now, now it is asking you to enter a letter. Now, let's say we enter a type of letter, say like A, we give OK. You see like, you know, it is now telling me it's a Wobble.

Similarly, now, now let me type in some non-wobble letter like say Z. And it tells me that is now it's not a Wobble. So this is how you kind of write, you know, write a sample TypeScript program, which helps you to execute. OK, just for your information, as I said earlier, you can now click on this .js to see how this gets internally executed, like transpired into a JavaScript program. So that same TypeScript, what the compiler does is to transpire. It's simply kind of like, you know, this letter is the same thing because as I said earlier, like, you know, JavaScript does not allow data typing.

So it just simply converts it into a simple JavaScript statement without this exclamation at the end. And after that, what it does is, since this enumerator data type is not present in JavaScript, it simply kind of like, you know, writes a, just converts it into an object as you can see over here. So what it does basically is it just kind of creates an object out of this and later the same statement gets executed over here as well. So that's how like, you know, this TypeScript is being compiled into JavaScript by the browser before execution.

OK, and if there are any errors, you can also see those errors over here. And if any runtime logs you want to see, that can be seen over here. So this is pretty much the way how you can play around with TypeScript for now, like in your free time and understand it without bothering about to install it in your local and do all that thing. And as part of the assignment for this week, we will be writing a simple TypeScript program for your understanding, which you can write it over here.

And also, like, you know, we'll be just creating a simple HTML or CSS JavaScript based web application just for you to understand how can you write any vanilla application. OK, so with that, we have now come to the summary section of week one. So let's quickly summarize what we have learned so far. So first we saw how web applications run directly on web browser using a single code base for all platforms. So we understood what are the technologies which are used by web applications to run in a browser.

Then we saw what is native and hybrid application. We saw what is progressive web application and a single page application. We saw that with the help of examples. And after that, we saw just a high-level overview about various frameworks, libraries, and patterns which are used in front-end web development. Wherein we saw what are the various options and choices which are available to us in order to create modern web application. And finally, we saw a bit about Angular and TypeScript where we just touched the overview of concepts of what is Angular.

What is the work all about and what is the TypeScript language all about. So with that said, these are a few references link for you to go through. So in case if you are very new to web development and you don't have much knowledge about web technologies, I strongly recommend you guys to go through these links. This will help you to have some additional understanding about the web technologies which we have discussed so far. So with that, we have come to end of this first week. Thank you for your time and looking forward to see you in the next week.

Want the rest of Angular Web Development for the Real World?

Get the full course syllabus and fees.

The full course is paid (₹40,000). We'll send the syllabus and call you back within one working day.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Full course · paid

Unlock the full Angular Web Development for the Real World course

The remaining 50 lessons, mentor-reviewed projects and a certificate come with the paid course (₹40,000). Leave your details: we'll send the syllabus and fees and call you back.

Get the syllabus and fees

A counsellor calls you back within one working day.

By submitting you agree to our Terms and Privacy Policy.

Grow by Skill-Lync · free lesson

Start watching

Free, no payment. Leave your details once and every free lesson on Grow plays straight away. A Skill-Lync counsellor may call you about the full Angular Web Development for the Real World course.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.