• Register
2,500 points
9 2

Q1.What is Typescript?


TypeScript is a free and open-source programming language developed and maintained by Microsoft. It is a strongly typed superset of JavaScript that compiles to plain JavaScript. It is a language for application-scale JavaScript development. TypeScript is quite easy to learn and use for developers familiar with C#, Java and all strong typed languages.

TypeScript can be executed on Any browser, Any Host, and Any Operating System. TypeScript is not directly run on the browser. It needs a compiler to compile and generate in JavaScript file. TypeScript is the ES6 version of JavaScript with some additional features.

Q2.What is the difference between var and let in Typescript?


1.var declaration done at function scoped and let declaration done at block scoped.

2.var allow you to re-declare the same variable in the same scope. whereas let will not

Q3.What are the disadvantages of TypeScript?


  • TypeScript has the following disadvantages:
  • TypeScript takes a long time to compile the code.
  • TypeScript does not support abstract classes.
  • If we run the TypeScript application in the browser, a compilation step is required to transform TypeScript into JavaScript.
  • Web developers are using JavaScript from decades and TypeScript doesn’t bring anything new.
  • To use any third party library, the definition file is must. And not all the third party library have definition file available.
  • Quality of type definition files is a concern as for how can you be sure the definitions are correct?

Q4.Why typescript is strongly typed?


Typescript is strongly typed to grammatical benefits to this language while still allowing the user to write normal Javascript. It also ensures the production of predictable results with fewer errors and more secure.

Q5.What is the use of decorators in Typescript?


In typescript, decorators are used to contributing a way to add both Meta programming syntax and glossary for members and declarations.

Q6.Which object-oriented terms are supported by Typescript?


Typescript supports the following object-oriented terms:

  • Classes
  • Modules
  • Interfaces
  • Data types
  • Member functions
  • Inheritance

Q7.What are the types of scopes available in Javascript?


There are two types of scopes available in Javascript, they are:

  • Local Scope
  • Global Scope

Q8.What is a typescript Map file?


The Typescript map file is a source map file which holds information about our original files.

Many debuggers can consume these files so we can debug the typescript file instead of the Javascript file

.map files are source map files that let tools map between the diffuse Javascript code and the typescript source files that created it

Q9.What are the benefits of typescript?


  • Typescript has the following benefits:
  • Offers type checking
  • Compile-time error checking
  • Impose coding guidelines
  • Use class-based object-oriented programming
  • It helps in code structuring etc.

Q10.What are methods overriding in Typescript?


If child class has the same method as declared in the parent class, it is known as method overriding.

Rules for Method Overriding:

The method must have the same name as in the parent class

There must be an IS-A relationship

The method must have the same parameter as in the parent class

Q11.Explain Enum in Typescript?


Enumeration is a typescript data that allow us to determine a set of named constants. Using enums can make it easier to document intent or create a set of distinct cases.

Q12.What is Arrow Function?


ES6 version of typescript arranges shorthand syntax for defining the nameless function, i.e. for function expressions. These arrows operate are also called lambda functions.

Q13.What is “as” syntax in typescript?


The as is the additional syntax for type assertion in Typescript. The reason for introducing the as syntax is that the original syntax () conflicted with JSX.

Q14.What is the default access modifier for members of a class in typescript?


In typescript, each member of the class is public by default.

Q15.Does typescript support all object-oriented principles?


Yes, typescript supports all object-oriented principles. There are mainly four principles to object-oriented programming:

  • Encapsulation
  • Abstraction
  • Inheritance and
  • Polymorphism

Q16.How to overload a function?


Use the same function name again above the original function without the brackets {}. Change the number of arguments, the arguments types or/and the return type.


function add(x: string, y: string): string;
function add(x: number, y: number): number {
  return x + y;

Q17.How to easily make all properties of an interface optional?


 Use the Partial mapped type.


interface Person {
  name: string;
  age: number;
}type PartialPerson = Partial<Person>; // Same as next linesinterface PartialPerson {
  name?: string;
  age?: number;

Q18.Typescript interview questions and answers for beginners.


Welcome to Typescript interview questions (pdf) and answers for beginners, Here are some tricky typescript interview question and answers collection which is asked in the interview. May it will help you to crack your typescript interview.


  • acte.in
  • learning.shine.com
  • levelup.gitconnected.com
  • dotnettutorial.co.in
2,500 points
9 2