TypeScript has gained massive popularity in recent years. According to Stackoverflow’s 2020 survey, TypeScript is the 2nd most loved programming language in the world (it was 3rd most loved in 2019) - clearly showing that the increase in popularity is quite astounding.
TypeScript (developed by Microsoft) is an open-source programming language that compiles into JavaScript. Since its release in 2012, the language has remained in active development and is gaining popularity and recognition every year.
TypeScript has gained massive popularity in recent years. According to Stackoverflow’s 2020 survey, TypeScript is the 2nd most loved programming language in the world (it was 3rd most loved in 2019) - clearly showing that the increase in popularity is quite astounding.
TypeScript (developed by Microsoft) is an open-source programming language that compiles into JavaScript. Since its release in 2012, the language has remained in active development and is gaining popularity and recognition every year.
The development community strongly associated TypeScript with Angular in the early days but now you can use it with practically anything like ReactJS, Node.js, Deno etc.
Is it too late to start learning TypeScript now?
Well, it is never too late if you start TODAY. Gain an advantage by being the one among those who really understand TypeScript and not just treats this as a college project.
TypeScript & JavaScript are the same right? NO.
While TypeScript is a superset of JavaScript; it means TypeScript eventually gets compiled into JavaScript, so they are not the same.
The main benefit of TypeScript is its static typing feature that provides additional information about your code which serves as better documentation for other developers and enables them to catch more mistakes during compilation right away.
The language is modern with features like interfaces, unions, intersection types, enums, classes, and visibility scopes. Additionally, because it is a superset, it has all the modern JavaScript features like destructuring, arrow functions and optional chaining operators too.
This course is just not about the basics, I will take you to advanced levels with practical real-world interview questions which will help you to understand the concept and also answer properly at the same time.
What's in the course?
Like all my courses, we have sections packed with beginner to advanced level content, so it is advised to check the full course curriculum first to get a clear idea of all the topics and then start step by step. Here's a quick summary of what you'll find in the course:
Introduction
TypeScript fundamentals
Array & Tuple
Functions
ENUM
Object Oriented TypeScript
TypeScript compiler
Interface
Decorators
TypeScript Modules & Namespaces
I recommend that you have a good understanding of OOPs concepts and basic JavaScript before continuing on with this tutorial, so as to make the most of it. If you have any JavaScript-related questions, feel free to check out my JavaScript course.
Take action today and enroll in this comprehensive course.
Relative Questions:
Q1: Explain the syntax of declaring a variable
Q2: Is there any convention or rule to follow while declaring a variable?
Relative Questions:
Q1. What all types of values a number can store in typescript?
Q2. How will you store a binary or hex value in typescript?
Relative Questions:
Q1. What will be the output of below given code?
let a:boolean = !true;
console.log(!a);
Relative Questions:
Q1. Explain the differences between null and undefined
Q2. When do you need the void data type?
Relative Questions:
Q1. When do you think “any” type is useful in your code?
Relative Questions:
Q1. When does typescript infers the data type?
Relative Questions:
Q1. What is hoisting?
Q2. How does block scope work?
Q3. What is the scope of a variable?
Relative Questions:
Q1. Explain various ways to declare a string variable
Q2. How will you deal with unicode characters?
Q3. Show the syntax to display long unicode characters
Relative Questions:
Q1. What is a Template Literal?
Q2. How will you display a value or an expression inside template string?
Q3. What is the advantage of using template string ?
Relative Questions:
Q1. How can you define your own custom data type?
Q2. What is type alias/aliases?
Relative Questions:
Q1. What is “never” type? Explain with an example?
Q2. What is the difference between “void” and “never” type?
Relative Questions:
Q1. What is the watch mode & how can you run TypeScript Compiler in watch mode?
Relative Questions:
Q1. What is the use of tsconfig.json file? How do you create it?
Q2. What is the use of tsc --init?
Q3. How can you avoid selected files from getting compiled?
Relative Questions:
Q1. What is the purpose of target option in tsconfig.json?
OR
How can you set the compiled file target or compiled file version?
Relative Questions:
Q1. What is the purpose of the “lib” option?
Q2. What will be the default value of “lib” option?
Relative Questions:
Q1. What is the purpose of the Module options?
Q2. How can you compile a file by giving the module setting at the command line (CLI)?
Relative Questions:
Q1. How do you set a separate path for all compiled files? OR What does outDir do?
Q2. What happens to the subfolders of the source folder when you compile the TypeScript project?
Relative Questions:
Q1. How can you compile all '.ts' files in a single bundle of JavaScript code?
Relative Questions:
Q1. What is the purpose of setting the root directory?
Q2. Which value is considered in “outDir” by default if it is not set?
Relative Questions:
Q1. What is removeComments?
Q.2. What is noEmit?
Relative Questions:
Q1. What is a source map file? Explain the advantage of it
Q.2. What is the purpose of mapRoot option?
Q.3. How does mapRoot setting affect the value of sourceMappingURL?
Relative Questions:
Q1. What is the use of “inlineSources”?
Relative Questions:
Q1. What is an array? Explain in detail
Q2. How will you get the last element of the array?
Q3. Get all odd numbers from the array
Relative Questions:
Q1. What is a tuple and how is it different from an array?
Relative Questions:
Q1. How can you define a variable with more than 1 type of data?
Q2. Is it possible to have an array with union data type?
Relative Questions:
Q.1: What is the difference between push() & unshift() method?
Q.2: What is the difference between pop() & shift() method?
Q.3: How can you insert an element at a given position?
Q.4: How can you remove a specific element?
Q.5 What does splice() method return?
Q.6: If there is no element removed then what will the splice() method return?
Relative Questions:
Q.1: Find length of each element in a new array.
Q.2: Find square root of every element & store it in a new array.
Q.3: Get all product names i.e., pNames in a new array.
let products = [
{pCode:1001, pName: "Apple"},
{pCode:1001, pName: "Banana"},
{pCode:1001, pName: "Grapes"},
{pCode:1001, pName: "Oranges"},
]
Relative Questions:
Q1. Get sum of a key field of an object literal e.g. the object is
const employees=[
{eNo:1001,salary:3000},
{eNo:1002,salary:2200},
{eNo:1003,salary:3400},
{eNo:1004,salary:6000}
]
Q2. Find avg value of all elements of an array?
Q3. Find the sum or product of all elements?
Q4. What is the difference between reduce() and reduceRight()?
Relative Questions:
Q1. How to flatten a 2D or a multidimensional array?
Relative Questions:
Q1. What is the difference between for..in & for..of?
Relative Questions:
Q1. What will be the output of the code?
let arr: string[] = ["ES5","ES6","ES7","ES8"];
arr.forEach((elem, index)=> {
console.log(elem, index);
if(index==2){
break;
}
});
Q2. What will be the output of below statements?
let arr: number[] = [7,9,0];
console.log(arr[arr.length]);
Relative Questions:
Q.1: What is the difference between find() & filter() method?
Q.2: If there is no value to return, What will findIndex() method return?
Q.3: What is the difference between indexOf() & includes() method?
Q.4: How will you search multiple values in an array?
Q.5 What will be the output of this code?
let arr: string[] = ["One","Two","Three","Four","Five"];
console.log(arr.lastIndexOf("Abcd"));
Relative Questions:
Q1. What will be the output in case an array has "undefined" while sorting the values?
Q2. How to sort an object literal?
const employees = [
{eNo:1001, salary:3000},
{eNo:1002, salary:2200},
{eNo:1003, salary:3400},
{eNo:1004, salary:6000},
]
Q3. How will you sort a numeric array?
Q4. Sort all values of array in descending order.
Relative Questions:
Q1. What is the destructuring assignment?
Q2. Swap values using destructuring
Q3. What will be the output of this code?
let [a,b,c] = [5,,7];
console.log(a,b,c);
Q4. How will you set a default value while destructuring an array?
Relative Questions:
Q1. Explain TypeScript function & how is it different from JavaScript?
Relative Questions:
Q1. How do you invoke an anonymous function?
Q2. What will be the output of below given code
let sum = function(a:number, b:number):number {
return a+b;
}
console.log(typeof sum);
Relative Questions:
Q1. Explain arrow function syntax.
Relative Questions:
Q1. How will you pass default values to a parameter in a function?
Q2. What is the advantage of optional parameter feature?
Relative Questions:
Q1. Create a function which can take any number of values & return sum of all numbers
Q2. Create a function which can take any number of names & displays all names separated with comma
Relative Questions:
Q1. Explain what is a function type?
Relative Questions:
Q1. What is function overloading and how will you implement it?
Relative Questions:
Q1. What is enum and How can you create it in TypeScript?
Q2. Explain advantages of enum.
Q3. What will be the value of WED i.e. Wednesday in below example:
enum WorkDays{
MON=1,
TUE=3,
WED,
THU,
FRI
}
console.log(Workdays);
console.log(Workdays.WED);
Relative Questions:
Q1. Explain computed enum members. Give an example
Relative Questions:
Q1. What is reverse mappings with enum?
Relative Questions:
Q1. Can you have dynamic keys with Object Literal?
Relative Questions:
Q1. How can you add read-only properties to an object?
Relative Questions:
Q1. What will be the output of this code?
let obj = {a: 'First'};
let obj1 = obj;
obj1.a = "Second";
console.log(obj.a);
Q2. How can we create a clone or separate copy of an Object Literal?
Relative Questions:
Q1. What will be the output of this code if you run it in the browser and why?
function test() {
console.log(this);
}
test();
Q2. What is the context of "this" inside arrow functions? Or What will be the output of this code?
let obj = {
test:()=>{
console.log(this);
}
}
obj.test();
Relative Questions:
Q1. How will you create a class in TypeScript?
Q2. What is a constructor? How is it called?
Q3. How do you refer to the field/property method of a class?
Q4. How do you access property within the class?
Q5. What do you mean by a member of a class? How many members do you see in this class code?
class car{
color: string;
seats: number;
constructor(c:string, ns:number) {
this.color = c;
this.seats = ns;
}
buidCar(){
console.log(this.color, this.seats);
}
}
let c1 = new Car("Red", 2);
let c2 = new Car("Blue", 4);
c1.buidCar();
c2.buidCar();
Relative Questions:
Q1. How do you inherit a class?
Q2. Why do you need the super() method? Explain in detail.
Relative Questions:
Q1. Explain various access modifiers of a class.
Q2. Which is the default access modifier?
Q3. Can you have protected modifier without inheritance?
Relative Questions:
Q1. What are property initialization shorthands?
Relative Questions:
Q1. How will you make a property readonly?
Q2. Can you have a readonly modifier a with public, private or protected modifier?
Q3. make a private property readonly property parameter syntax.
Q4. What is the difference between readonly and const?
Relative Questions:
Q1. How do you make any member static in a class?
Q2. Explain the purpose or advantage of making a member static.
Relative Questions:
Q1. Explain a practical scenario of Object Literal Destructuring.
Q2. Explain the output of this code?
Const {a = 90, b} = {};
Console.log(a,b);
Relative Questions:
Q1. What is an abstract class?
Q2. Can we create a constructor() in an abstract class?
Q3. Is it possible to add instance variables in an abstract class?
Relative Questions:
Q1. What is a getter or setter method?
Relative Questions:
Q1. What is an Interface or Object Types in TypeScript?
Q2. What is the difference between custom types i.e., type & interface?
Relative Questions:
Q1. How can you make sure that a class follows certain signature?
Q2. How do you apply an interface on a class?
Q3. How can you apply multiple interfaces on a class?
Q4. How can you provide an optional property inside an interface?
Relative Questions:
Q1. How can you make properties readonly via interphase?
Relative Questions:
Q1. How will you inherit an interface?
Q2. Can you extend multiple interfaces & how?
Relative Questions:
Q1. What is typescript generics? Explain with syntax
Q2. Is it necessary to pass data type with function call when you call generic function?
Q3. What will be the output of the below given code?
function getData<T>(dataPoints : T[] ) : T[] {
return new Array<T>().concat(dataPoints);
}
let numDP = getData([30,560,120,90]);
let strDP = getData(["Top","Bottom","Left"]);
numDP.push(68);
strDP.push("NE");
numDP.push("Right");
strDP.push(120);
console.log(numDP);
console.log(strDP);
Relative Questions:
Q1. How can you use multiple type variables?
Q2. Is it possible to have generic and non generic types together?
Relative Questions:
Q1. What is Generic Constraint & how we can add it?
Relative Questions:
Q1. How to implement generic classes?
Relative Questions:
Q1. Explain syntax of how to define generic interface
Q2. Give an example of using generic interface as the function type
Relative Questions:
Q1. What is a module?
Q2. Can you import any module inside a script tag?
Q3. How will you run the import and export statements on a local machine?
Relative Questions:
Q1. What is named export & import?
Q2. Can you avoid {} while importing a named module?
Q3. How can you import all named modules from a file?
Q4. Is it a good practice to import all modules together?
Q5. Do the modules hoist?
Q6. Do you need the same name while importing a named module or you can change?
Relative Questions:
Q1. What is default import/export & the difference between named & default import/export?
Q2. Explain various ways of implementing default export & import
Relative Questions:
Q1. How do you deal with modules in TypeScript?
Relative Questions:
Q1. What is namespace? Explain the syntax
Q2. How will you compile multiple namespaces in a single file?
Q3. Explain the syntax of managing nested namespaces
Relative Questions:
Q1. How will you define decorator for a class?
Q2. Explain parameters passed to the decorator function when its applied to the class?
Relative Questions:
Q1. Make a method enumerable with the help of method decorator
Q2. Explain parameter details of method decorator function
Q3. Change method definition using decorator
Relative Questions:
Q1. What is an accessor decorator?
Relative Questions:
Q1. Explain property decorator with syntax.
Q2. Create a property decorator factory which adds a given prefix to the property value.
Relative Questions:
Q1. What is parameter decorators?
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.