July 14, 2017

Top interview questions for Typescript

TypeScript  is a free and open-source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript, and adds optional static typing to the language. 


Here are the top 5 interview questions for the Typescript:





Q1 — What is Typescript and why one should use it?

A1- TypeScript is a free and open-source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language.

WHY? → TypeScript lets you write JavaScript the way you really want to. TypeScript is pure object oriented like Java. TypeScript can help programmers to write object-oriented programs and have them compiled to JavaScript, both on server side and client side.

Q2 — What are Modules in Typescript?

A2- Modules in Typescripts are very useful. Modules in Typescript helps in organizing the 
code. There are 2 types of Modules — Internal and External
Internal Modules are now replaceable by using Typescript’s namespace.
External Modules —used to specify and load dependencies between multiple external js files. If there is only one js file used, then external modules are not relevant

Q3— What are types in TS?
A4- Types in Typescript define the data-type. It helps in avoiding the wrong value passing. There are 2 different types:

- Built in — String, Number, boolean, Null, Undefined, any
- User Defined — Array, object, classes, interfaces

Q4 — How you can use TS with jQuery, Angularjs and Reactjs

A5- Angularjs is already integrated with Typescript.So, if you are using Angularjs CLI you don’t need to do anything special.

For React and jQuery use Typescript’s @types and it will install all the dependencies.

@types/ React
@types / jQuery



No comments: