TypeScript Interview Questions: TypeScript is an open-source programming language developed and maintained by Microsoft. TypeScript is a superset of JavaScript that compiles to plain JavaScript.
Typescript Interview Questions
Q: What is TypeScript?

TypeScript is a superset of JavaScript that compiles to plain JavaScript. It is developed and maintained by Microsoft.

You may also like - React.js Interview Questions
Q: Who is the founder of TypeScript?

Microsoft Corporation

Q: What are the types in TypeScript?

There are mainly two types of data types:

  • Built-in: This includes number, string, boolean, void, null and undefined.
  • User-defined: It includes enums, classes, interfaces, arrays, and tuple.
//Boolean let isDone: boolean = true; //String let name: string = "Full Stack Tutorials"; //Number let decimal: number = 10; //Array let list: number[] = [1, 2, 3, 4, 5]; //Any let notSure: any = 5; //Null & Undefined let u: undefined = undefined; let n: null = null;
Q: What are the Benefits of TypeScript?
  1. It helps in code structuring
  2. Typescript is purely object oriented programming.
  3. It offers a "compiler" that can convert to JavaScript equivalent code.
  4. It has a concept of namespace defined by a "module".
  5. Type checking
  6. Compile time error checking
  7. Code completion and intelligence
Q: What are the features of TypeScript?
  1. tsc --init
  2. extends in tsconfig.json
  3. type vs interface
  4. keyof
  5. Mapped Types
  6. Mixin classes
  7. object vs Object
  8. Transpiling async/await to ES5/ES3
  9. String valued enums
  10. allowJs, checkJs, // @ts-check
Q: How to install typescript using NPM?
npm install -g typescript
Q: How to compile a typescript file via command line?
tsc fileName //Example tsc helloworld.ts
Q: What are the Modules in Typescript?

Modules are the way to organize code in TypeScript. Modules contains classes and interfaces. It is same like namespace in C#.

Types of Modules:

  1. Internal Modules
  2. External Modules
You may also like - Node.js Interview Questions
Q: What are different components of TypeScript?

There are different types of components of TypeScript:

  1. Language
  2. Compiler
  3. Language Service
Q: Does TypeScript supports function overloading?

Yes, TypeScript does support function overloading but the implementation is a bit different if we compare it to OO languages.