eInterviewQuestions

Typescript Interviews Questions

All our users, you can also add/post your question and answer which is mostly asked by an Interviewer in Interviews, you all can suggest for any changes to make our website best & user friendly. please feel free to Post Question.

Q1. What is Typescript?

TypeScript is an open source programming language written on top of JavaScript to support types. TypeScript is not a completely new language and is not intended to replace JavaScript in anyway. It adheres to all principles of JavaScript and just adds types on top of it. 

Typescript is a superset of JavaScript which primarily provides optional static typing, classes and interfaces. 

Typescript is compiled to provide clean and simple JavaScript code which runs on any browser. It allows JavaScript developers for using highly productive development tools and practices like static checking and code refactoring.

Features of Typescript

1. Typescript can be compiled to all major versions of Javascript(ES3,ES5,ES6,ES7).

2. Typescript can be used for cross –browser development and is an open source project.

3. Typescript is a superset of JavaScript that provides typed nature to your code.

4. It is used to avoid the disadvantages of JavaScript like Typescript is designed to handle the needs of complex programs.

 

5. Typescript is more predictable and is generally easier to debug.

Benefits of using Typescript

It provides the benefits of optional static typing .Here Typescript provides types that can be added to variables, functions, properties etc.

Typescript has the ability to compile down to a version of JavaScript that runs on all browsers.

Typescript tries to extend JavaScript. Compiler generates JavaScript.

Typescript is a backward compatible version of JavaScript that compiles to pure JavaScript which makes their writing easier and faster.

Typescript is purely object oriented programming which means it is a programming paradigm based on the concepts of objects.

Most important advantage is it offers a “compiler” that can convert to JavaScript equivalent code.


Q2. Differences between Typescript and JavaScript.

1. JavaScript don’t support Es6 while Typescript supports .

2. JavaScript build up reusable components by using functions and prototype-based inheritance 

3. Typescript supports Classes that allow programmer to think in more object oriented way .

4. JavaScript don’t have any interfaces while Typescript has interfaces.

5. There is no static typing in JavaScript whereas there is static typing in Typescript.

6. JavaScript has no optional parameter  feature while Typescript has optional parameter feature.


Q3. How to install typescript?

TypeScript can be installed and managed via npm, the Node.js package manager

npm install -g typescript