Angular & Signals (283 Qs)•Part 1: Architecture, Components, Directives & Lifecycle (1 - 35)
What is TypeScript?
TypeScript is a strongly typed superset of JavaScript created by Microsoft that adds optional types, classes, async/await and many other features, and compiles to plain JavaScript. Angular is written entirely in TypeScript as a primary language. You can install TypeScript globally as
cmd
npm install -g typescript
Let's see a simple example of TypeScript usage:-
typescript
function greeter(person: string) {
return "Hello, " + person;
}
let user = "Alex";
document.body.innerHTML = greeter(user);
The greeter method allows only string type as argument.