Top TypeScript frequently asked interview questions.
Q: What is TypeScript?
A : TypeScript is JavaScript for application-scale development. TypeScript is a strongly typed, object oriented, compiled language. It was designed by Anders Hejlsberg (designer of C#) at Microsoft. TypeScript is both a language and a set of tools. TypeScript is a typed superset of JavaScript compiled to JavaScript. In other words, TypeScript is JavaScript plus some additional features.Q: What are the features of TypeScript?
A :Features of TypeScript
- TypeScript is just JavaScript. TypeScript starts with JavaScript and ends with JavaScript. TypeScript adopts the basic building blocks of your program from JavaScript. Hence, you only need to know JavaScript to use TypeScript. All TypeScript code is converted into its JavaScript equivalent for the purpose of execution.
- TypeScript supports other JS libraries. Compiled TypeScript can be consumed from any JavaScript code. TypeScript-generated JavaScript can reuse all of the existing JavaScript frameworks, tools, and libraries.
- JavaScript is TypeScript. This means that any valid .js file can be renamed to .ts and compiled with other TypeScript files.
- TypeScript is portable. TypeScript is portable across browsers, devices, and operating systems. It can run on any environment that JavaScript runs on. Unlike its counterparts, TypeScript does not need a dedicated VM or a specific runtime environment to execute.
Q: What are the Components of TypeScript?
A : A TypeScript consists of 3 components -- Language
- TypeScript Compiler
- TypeScript Language Service
Q: How to convert a String to number in TypeScript?
A :var a = "32"; var b: number = +a;
Q: What is difference between Interfaces and Types in TypeScript?
A : One difference is that interfaces create a new name that is used everywhere. Type aliases does not create a new name - for instance, error messages do not use the alias name.Unlike an interface declaration, which always introduces a named object type, a type alias declaration can introduce a name for any kind of type, including primitive, union, and intersection types.
Q: How to remove an array item in TypeScript?
A :
const index = dataArray.indexOf(key, 0);
if (index > -1) {
dataArray.splice(index, 1);
}
See Also
Spring Boot Interview Questions Apache Camel Interview Questions Drools Interview Questions Java 8 Interview Questions Enterprise Service Bus- ESB Interview Questions. JBoss Fuse Interview Questions Angular 2 Interview Questions
Popular Posts
1Z0-830 Java SE 21 Developer Certification
Azure AI Foundry Hello World
Azure AI Agent Hello World
Foundry vs Hub Projects
Build Agents with SDK
Bing Web Search Agent
Function Calling Agent
Spring Boot + Azure Key Vault Hello World Example
Spring Boot + Elasticsearch + Azure Key Vault Example
Spring Boot Azure AD (Entra ID) OAuth 2.0 Authentication
Deploy Spring Boot App to Azure App Service
Secure Azure App Service using Azure API Management
Deploy Spring Boot JAR to Azure App Service
Deploy Spring Boot + MySQL to Azure App Service
Spring Boot + Azure Managed Identity Example
Secure Spring Boot Azure Web App with Managed Identity + App Registration
Elasticsearch 8 Security - Integrate Azure AD OIDC