Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is angular2 typescript and angular2 ecma script

Tags:

angular

I'm learning Angular2. What is the difference between Angular2 with typescript and angular2 with ecmascript?

like image 656
Bharath Kumar Avatar asked Jan 21 '16 07:01

Bharath Kumar


People also ask

What is the difference between JavaScript TypeScript and ECMAScript?

TypeScript is a free and open-source pure object-oriented programming language. It is developed and maintained by Microsoft. ES6 is a version of ECMAScript (ES), which is a scripting language specification standardized by ECMA international. Typescript is to eradicate the development errors.

What are ECMA scripts?

ECMAScript, also known as JavaScript, is a programming language adopted by the European Computer Manufacturer's Association as a standard for performing computations in Web applications.

What is the need for TypeScript in Angular 2?

Its declarative style makes it easy to define and add features without a lot of manually written boilerplate, and the fully integrated TypeScript language gives you the benefits of a statically typed language within the JavaScript ecosystem.

Does TypeScript also support ECMAScript?

Features. TypeScript is a language extension that adds features to ECMAScript 6. Additional features include: Type annotations and compile-time type checking.


1 Answers

ECMAScript is the standard. JavaScript is the implementation. When people say ECMAScript they often mean JavaScript... the JavaScript that browsers understand.

Typescript is a "typed superset of JavaScript that compiles/transpiles to JavaScript." Today, that means you'll compile/transpile your TypeScript code into ECMAScript 5/ES5, since most browsers support that version. In the future, as browser support grows for ECMASCript 6/ES6/ES2015, you could compile your TypeScript into ES2015 instead of ES5.

TypeScript's primary purpose is not to add features to JavaScript – as is the purpose of ES2015 – but to make it easier and safer for developers to write and maintain large JavaScript applications. The primary benefit of TypeScript shows up before your application runs – when you're writing or maintaining code. Intellisense, code completion, the ability to use ES2015 features today, etc.

Angular 2 is written in TypeScript. If you write Angular 2 applications, I strongly recommend that you use TypeScript.

like image 99
Mark Rajcok Avatar answered Sep 27 '22 23:09

Mark Rajcok