background preloader

Typescript

Facebook Twitter

Why did the Angular team choose TypeScript over Dart? When you’re looking at JavaScript alternatives, TypeScript and Dart often spring to mind. With the recent hoopla over Angular 2.0 making the rounds, the decision to go with TypeScript over Dart has been met with much contention and debate. The question has already been posted on Reddit, and some users on Hacker News are now looking to move on from Angular altogether as a result of their TypeScript alliance. So what are the reasons behind the Angular and TypeScript pairing? Microsoft and Google are now buddies The recently announced collaboration between Microsoft and Google marked the end of AtScript, the short-lived ‘syntax sugar’ that Angular 2.0 was wanting to introduce. The partnership is a big deal to both sides, with Microsoft able to work on bettering TypeScript and allowing wider use, while Google are able to satisfy their own userbase who are (for the most part) firmly entrenched in JavaScript already. Is Dart unmanageable for big and complex stuff?

ECMAScript 5 compatibility table. Modularization in TypeScript. In my last post, I introduced TypeScript, Microsoft’s new offering which layers static typing on top of JavaScript. Today I’d like to go further and discuss modularization and code organization. TypeScript has the ability to take advantage of a pair of JavaScript modularization standards – CommonJS and Asynchronous Module Definition (AMD). These capabilities allow for projects to be organized in a manner similar to what a “mature,” traditional server-side OO language provides. This is particularly useful for the most likely candidates for TypeScript – large Web Applications.

Although TypeScript’s modularization is powerful, it requires some background knowledge of CommonJS and AMD, and has its pitfalls. On the State of Modularization in JavaScript Organizing scripts in JavaScript-based web apps has historically been a thorny issue. Okay, so that’s a bit of a dramatization. CommonJS and AMD The primary differences between CommonJS and AMD are as follows: CommonJS app.js Simple enough, right? Modules Node.js v0.10.22 Manual. Stability: 5 - Locked Node has a simple module loading system. In Node, files and modules are in one-to-one correspondence. As an example, foo.js loads the module circle.js in the same directory. The contents of foo.js: var circle = require('. The contents of circle.js: var PI = Math.PI; exports.area = function (r) { return PI * r * r;}; exports.circumference = function (r) { return 2 * PI * r;}; The module circle.js has exported the functions area() and circumference().

Variables local to the module will be private, as though the module was wrapped in a function. If you want the root of your module's export to be a function (such as a constructor) or if you want to export a complete object in one assignment instead of building it one property at a time, assign it to module.exports instead of exports. Below, bar.js makes use of the square module, which exports a constructor: var square = require('. The square module is defined in square.js: Cycles# Consider this situation: a.js: b.js: main.js: . x.js: TypeScript for ActionScript Developers.

Introduction The following covers what the TypeScript language is compared to ActionScript 1, 2, and 3 with as much context as possible and compares the syntax side by side. This article should help serve as a reference while you learn TypeScript. Also, these articles always help me learn while writing them and I like to have documentation I can refer to later. You cannot really talk about ActionScript without talking about the Flash Player internals just like you can’t really talk about JavaScript for web development without also talking about browser internals.

What is TypeScript? TypeScript is awesome. Optional TypingClassesPackages via Namespacessupports privatemoduleseverything compiles to JavaScripteverything using classes/packages/modules compiles to RequireJS/AMD/CommonJSYou can code in normal JavaScript; TypeScript is optional; you can mix and matchall the TypeScript features for typing aren’t compiled into JavaScript (no enforcement) so it’s normal JavaScript that gets outputted.

Typescript.