Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Angular require TypeScript?

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.

like image 730
Ian Ringrose Avatar asked Aug 04 '15 11:08

Ian Ringrose


People also ask

Can I use JavaScript instead of TypeScript in Angular?

Yes, you can.

Is Angular same as TypeScript?

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.

Is TypeScript really necessary?

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.

Is Angular A TypeScript framework?

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.


1 Answers

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.

like image 59
Jesse Good Avatar answered Sep 18 '22 12:09

Jesse Good