I have just had a look at the Angular quickstart document and it shows the usage of TypeScript. A thought has just popped into my mind:
Does Angular require TypeScript?
Then a few seconds later:
How does Angular relate to TypeScript?
A quick Google of the first question does not lead to a direct answer. As I can’t be the first or the last person to ask this question, I am posting it to Stackoverflow.
Yes, you can.
Fundamentally, Angular and TypeScript are very different tools, though they are not mutually exclusive. In fact, TypeScript is actually a part of Angular 2, allowing Angular 2 developers to do their JavaScript work in TypeScript.
TypeScript is absolutely not critical to JavaScript. You can write a JavaScript app without it, much the same you can write a pure JavaScript app in lieu of a React app. Apps with many blocks of repeated code could benefit from a library that boasts reusability and Virtual DOM updating.
Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your applications.
Does Angular require Typescript
No it doesn't. You can use normal Javascript also. The designers wanted to give as many choices as possible so the framework is easily accessible by many people. The Typescript compiler generates ES6/ES5 compliant code you can consume.
The Angular2 "Getting Started" shows all examples in both TypeScript and ES5.
How does Angular relate to Typescript
All the source code will be written in Typescript.
However, they also need to support transpiling to Dart (using ts2dart), so some parts of the code base are written just so transpiling to Dart is possible. For example, Dart has a notion of constant expressions, so they have to use CONST_EXPR
in the TS code (which makes the code base more complicated). This is only an implementation detail and user code does not have to worry about this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With