15 ms·
Angular 2: Built on TypeScript
- JustSomeNobody 12y agoIs javascript really so bad? Edit: Why did this question get down voted? It was an honest question...
- tinza123 12y agoIt probably is if you have to deal with > 25k LOC code base like what Angular has.
- JustSomeNobody 12y agoWell, there's their problem... Edit: Ok, for the down voters. Angular is HUGE. And all that code has to get shoved onto the client side when someone visits a page. And that's JUST for the framework. We aren't even talking about the application code yet. More and more clients are mobile. Nobody sees a problem here? You're using more (precious) data, it's slower to load and slower to run. It's just a nasty little trend going on. NOW LET'S SEE SOME FREAKING DOWN VOTING!!!
- jaredmcateer 12y agoOnly if you have caching disabled. If you use a CDN, the library is likely already on the users computer. That said their 25k loc code base is 123kb (45kb gzipped)
- path411 12y agoI find a common theme among the people who freak out about 45-100kb of js are often the people with 3MB of images on their page.
- dang 12y agoPlease don't comment about downvotes or bait other users into downvoting you. Those are rules of the site: https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- WalterSear 12y agoNot unless you try to make it look like Java.
- possibilistic 12y agoIt can be a challenge for sizable codebases, especially ones with many contributors and that undergoes steady refactoring. That feeling you get when you see code with lots of type checking... A lot of engineering effort could be recovered with static typing.
- WalterSear 12y agoOh, I have no problems with strong typing. In fact I think it's a good thing to add to angular. Angular, (And I say this as once upon a time contributor to Protractor) however, is kind of a step in the wrong direction, and I concluded this before they started flapping about with all these giant course corrections.
- deleted 12y ago[deleted]
- ensmotko 12y agoTo be fair, JavaScript started out as a language that looks like Java. "JavaScript was designed with Java's syntax and standard library in mind. In particular, all Java keywords were reserved in original JavaScript, JavaScript's standard library follows Java's naming conventions, and JavaScript's Math and Date objects are based on classes from Java 1.0" -- http://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Java http://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Java
- Sammi 12y agoThat cherry picking you just made just completely reversed what was actually said in that article: "A common misconception is that JavaScript is similar or closely related to Java. It is true that both have a C-like syntax (the C language being their most immediate common ancestor language). They also are both typically sandboxed (when used inside a browser), and JavaScript was designed with Java's syntax and standard library in mind. In particular, all Java keywords were reserved in original JavaScript, JavaScript's standard library follows Java's naming conventions, and JavaScript's Math and Date objects are based on classes from Java 1.0,[116] but the similarities end there. The differences between the two languages are more prominent than their similarities. Java has static typing, while JavaScript's typing is dynamic. Java is loaded from compiled bytecode, while JavaScript is loaded as human-readable source code. Java's objects are class-based, while JavaScript's are prototype-based. Finally, Java did not support functional programming until Java 8, while JavaScript does, as it contains many features based on Scheme." And read this part too, it has much relevant info: http://en.wikipedia.org/wiki/JavaScript#Beginnings_at_Netscape http://en.wikipedia.org/wiki/JavaScript#Beginnings_at_Netsca...
- CmonDev 12y agoYes, it is really, really, really bad. http://wtfjs.com http://wtfjs.com Whole web is a mess and people are trying to monkey-patch it.
- kyberias 12y agoThis list has some weird examples. It's like the author makes some crazy requirements for Javascript. For example, I don't think it's particularly bad that array[-1] and array.charAt(-1) return different values. Also, I don't get the Math.Max() example with booleans. Seems perfectly logical to me.
- pyrocat 12y ago> Whole web is a mess and people are trying to monkey-patch it. That has been true for the last 20+ years, but it gets less and less accurate as time goes on. The web today is way less messy than it was even 3 years ago. The way we write JS is way less messy, the way we write CSS is way less messy. Standards have improved, lighten up.
- smrtinsert 12y agoAny dynamically typed language is absolutely horrible once you break a certain line count.
- davexunit 12y agoCitation needed. Static typing isn't a panacea.
- mikerichards 12y agoThe parent's post doesn't mean anything, but the please don't do a "citation needed". Even if he had a citation it wouldn't mean much. That said, static typing does help with intellisense/code completion, on-the-fly error checking, refactoring, etc...
- JustSomeNobody 12y agoAt that point, maybe it's better to take a few paces back instead of just one. This is an example of taking only one pace back.
- ianbicking 12y agoI don't personally find TypeScript a rejection of JavaScript in the way that some other transpiled languages are. It feels to me like optional typing plus a bunch of features JavaScript will get in ES6 or beyond.
- taylorbuley 12y agoCan anyone clarify if TypeScript usage is in place of Dart or in addition to Angular Dart?
- isoos 12y agoThey write their core in AtScript/TS, and cross-compile it to Dart and JS (ES5).
- Sammi 12y agoAtScript and Typescript have merged.
- munificent 12y agoMy understanding is that TypeScript will be used in place of AtScript—the language the Angular folks created to be able to cross-compile a single codebase to both JS and Dart. JS and Dart will still be first-class supported target languages.
- skrowl 12y agoThis isn't really a big jump, as they were using AtScript before which was really just a forked TypeScript: https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit97HnZoKVygDxpWzEYW0U/edit https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit9... They must have convinced Microsoft to accept their patches into mainline TypeScript.
- Bahamut 12y agoThe TypeScript program manager spoke about this just now at ng-conf (happening now) - their team reached out to the Angular team about this.
- aikah 12y agoNope, AtScript was doing runtime type checking (AtScript is basically traceur with some experimental features) while Typescript DOESNT. To be fair , I don't care, but that's an important precision. It means that the Angular team is giving up on traceur or maybe traceur and typescript will merge somehow in the future.
- skrowl 12y agoOf note, the BRAND NEW TODAY angular website still says it uses AtScript: https://angular.io/docs/js/latest/quickstart.html https://angular.io/docs/js/latest/quickstart.html ES6, AtScript, and the es6-shim AtScript Angular is built with AtScript. AtScript is an extension of ES6 (ECMAScript 6), the new specification of the JavaScript language. This quickstart features AtScript, but you can write Angular in ES5 or ES6 as well. ES6 AtScript compiles to ES6, which is not widely supported in all browsers today. The es6-shim.js file allows you to use ES6 or AtScript in the browser. es6-shim The quickstart repository includes es6-shim.js. The es6-shim.js file includes dependencies (such as Traceur) needed to compile ES6 in the browser. Traceur is an ES6 compiler that transpiles ES6 to ES5 code.
- lars 12y agoI don't see why anyone would want runtime type checking the way AtScript does it. With static typing, the compiler can catch type errors early, at the cost of rejecting some otherwise valid programs. With dynamic typing, that type checking is delayed until execution time. More programs are valid, but type errors are caught late. With AtScript-style late type checking, they took the dynamic type system and introduced more type errors. This decreases the amount of valid programs, yet catches no errors at compile time. It does nothing but increase the amount of bugs.
- boothead 12y agoWow! That's pretty big news! Very much looking forward to seeing what insights come out of rebuilding something like angular with types. edit actually on second reading, I'm not sure what's been rewritten in what?
- electrotype 12y agoWhy not Dart?
- aberatiu 12y agoYeah. Seriously, why not dart. Any clue, anybody?
- ratbeard 12y agoDart requires loading a dart runtime js file on to the page, as far as I know. And I think they would claim Typescript is javascript + some extra stuff on top, whereas dart is a whole new language to learn.
- dubcanada 12y agoNo Dart compiles to JS. Obviously there is some overhead with transpiling languages, but it's actually pretty small. They have done a good job with it.
- ratbeard 12y agoYes Dart compiles to javascript, but it has pretty different semantics from javascript and needs to insert extra javacript to get your transpiled javascript to run. For example, noSuchMethod isn't available in all js engines so using https://www.dartlang.org/articles/emulating-functions/#interactions-with-mirrors-and-nosuchmethod https://www.dartlang.org/articles/emulating-functions/#inter... in dart would require a non-trivial amount of wrapping code to be generated. http://stackoverflow.com/questions/8815437/why-is-javascript-files-generated-by-dart-is-so-huge http://stackoverflow.com/questions/8815437/why-is-javascript... > And the size of helloworld.dart.app.js is 102k > When ran in optimize mode, it generated the following javascript - helloworld.dart.js which is of size 20k
- ahoge 12y ago> And the size of helloworld.dart.app.js is 102k No, it's not. dart2js --minify hello.dart -o hello.dart.js Results in a 5 KB JS file. This game is 35 KB (procedural graphics included): http://mbtic.com/games/fuzetsu http://mbtic.com/games/fuzetsu
- usingpond 12y agoAs if we didn't have enough reason to move on from Angular. Now you need to learn Typescript to contribute or grok the source files?
- Bahamut 12y agoAngular 2 was being written in AtScript - in practice, not much has changed, just that Google and Microsoft are collaborating here and unifying efforts.
- thebouv 12y agoI think the important part here isn't that it is AtScript or TypeScript or ES6. It's that they're collaborating. I'm pretty sure that's a sign of the Apocalypse. We may want to stop worrying about transpiling and pay closer attention to the skies, looking for raining frogs and or blood moons.
- dmarg 12y agoI am pretty sure that TypeScript just adds type safety and is optional. I don't see this as a huge negative and I actually see this as a positive. Just curious, what and why are all your reasons to move away from Angular?
- deleted 12y ago[deleted]
- WalterSear 12y ago- Breaking changes - Obtuse, verbose, non-performant code - Did I mention breaking changes?
- pluma 12y agoDoes that mean they have finally given up on AtScript?
- dmarg 12y agoAtScript is now TypeScript is what they said in the opening remarks.
- dchuk 12y agoSo Angular has gone from being written in plain JS, to Dart, to Atscript, and now Typescript? Why so much jumping around? Isn't that creating a lot of technical debt issues?
- jlebrech 12y agonot really, everytime they switch they are filing for technical bankruptcy.
- Guillaume86 12y agoAtScript was pretty much just TypeScript + annotations
- lastofus 12y agoConstantly trying out the "new hotness" seems to be the norm in front end dev.
- WalterSear 12y agoDitching angular has been the new hotness for a while.
- mikeryan52 12y agoIt's a bit confusing, but basically right now there are two Angular products: AngularJS 1.x and AngularDart. These two efforts are supported by completely separate teams. Now the JS and Dart teams are merging and the new Angular 2.0 will be written in TypeScript and transcompiled down to ES6, ES5, and Dart. So while it may look like jumping around, the message seems to be consolidation.
- santialbo 12y agoThey made an Angular.js rewrite in Dart that has nothing to do with Angular 2.0. Angular 2.0 was written in ATScript which was basically Typescript with annotations. Now Typescript added annotations so there's no point in mantaining ATScript anymore.
- tonyedgecombe 12y agoEmbrace, extend, extinguish.
- jvilk 12y agoIf you're talking about TypeScript, I don't believe that mantra is applicable when the extensions are open source, liberally licensed (Apache License), cross-browser, and developed in the open. There's nothing proprietary or exclusive about it.
- logicalmind 12y agoHard to say. It didn't seem like Microsoft had a good strategy for modern web development (javascript/rest/etc.) at least from the client side. They had webforms/MVC but you pretty much had to use client side controls from other sources, like Telerik, if you wanted to do something modern. One assumes that tooling with javascript would be difficult for them to add in Visual Studio, say as compared to the tooling offered for C#. So moving to a typed language allows them to have nice Visual Studio tooling as well as picking a path for modern web development.
- jameshart 12y agoSeems more like AtScript was an 'embrace extend' attempt on TypeScript, which has been somewhat rebuffed...
- xiaq 12y agoTo extinguish, you introduce incompatibilities to make the life of people outside your inner ecosystem (compared to the greater, standard-compliant ecosystem) harder. But since TypeScript compiles to JavaScript and interfaces with plain JavaScript wells, there is really no "extinguish" part here. Also, the EEE accusation doesn't really apply to open source projects. EEE is bad since after the proprietary product supersedes ("extinguishes") an open product, the community loses control forever. However when an open product supersedes another, the community always have the choice of forking the project to take back control.
- aikah 12y ago
- digdigdag 12y agoAre there any organized efforts to fork the 1.x branch to sustain existing applications?
- swang 12y agoProb not from Google/Angular themselves. Maybe someone will be willing to maintain a 1.x branch for support $ ala what some people did for Rails 2.9.2+
- grumblestumble 12y agoNot so much to fork, but Angular 1.x is continuing to be developed and Pete Bacon Darwin has taken over as the technical lead: https://plus.google.com/+IgorMinar/posts/2Uo6yh4AV7L https://plus.google.com/+IgorMinar/posts/2Uo6yh4AV7L Angular 1.4 is well underway and there's a lot of good stuff coming out of it, for example the reworked router module.
- jffry 12y agoFYI the new router module (https://github.com/angular/router https://github.com/angular/router) is going to be a separate project, with semver'ed releases. It'll expose bindings for both Angular 1.x and Angular 2, but it isn't bound to the Angular release cycle. Here's a presentation from ng-conf today about the new router: https://www.youtube.com/watch?v=vecg70fPDFw https://www.youtube.com/watch?v=vecg70fPDFw
- Bahamut 12y agoThe official word[1] from the Angular team now is that they will support it as long as there is still a significant number of companies using it - it will be longer than the original 1.5 years after the release of 2.0 mentioned. [1] Mentioned in the ng-conf keynote IIRC, but this was also told to me directly by one of the Angular core team members when I spoke with him today.
- outsidetheparty 12y agoMy main feeling about this is not so much about typeScript (which, meh, some syntax sugar I don't care about, and tooltips for an IDE I don't use) -- more it's that just the mere whiff of Microsoft's involvement will be enough to snuff out remaining developer interest in Angular 2.
- darkmarmot 12y agoNot that I'm an M$ fanboy -- but you must admit there are tons of C# coders that might not mind...
- EugeneOZ 12y agoThere are not so many devs who hate MS just for being MS. Mostly kids.
- Sammi 12y agoEven less in these days of open source glory. I remember being a MS hater as a kid. Now I hate all the big software companies. Just some more than others. And MS is heading in the right direction these days, so I'm optimistic. Hopefully it'll stick.
- aikah 12y agoI don't care what people say Angular totally suffers from the second system effect. http://en.wikipedia.org/wiki/Second-system_effect http://en.wikipedia.org/wiki/Second-system_effect
- Igglyboo 12y agoYea but this is almost a given with projects that get this popular.
- watty 12y ago> The second-system effect is the tendency of small, elegant, and successful systems to have elephantine, feature-laden monstrosities as their successors due to inflated expectations.[1] Angular 2.0 is removing a lot of complexity and "magic" of 1.x. I've moved onto React but I think it's a bit too soon to say Angular 2.0 will be a bloated monstrosity relative to 1.x.
- deleted 12y ago[deleted]
- serve_yay 12y agoI would say the first version of Angular does, too.
- sam-mueller 12y agoI definitely concur. Having just attended emberconf, there's a stark contrast in how each framework is choosing to evolve with the web. Personally, I favor ember's approach of smaller, more iterative releases that are largely backwards compatible with previous versions. It not only means that teams building ember apps now can continue their efforts with confidence, but it's also a testament to the amount of thought and care the core team has placed in developing ember's abstractions; no major rewrite needed (so far). And ember's version 2.0 due out next quarter will be no different; same release cycle, same emphasis on compatibility with the added benefit of removing cruft that has built up in the codebase. Perhaps I'm speaking from the perspective of our products at Yahoo, but ember has suited us well for precisely these tenets. --Sam
- the_gipsy 12y agoYay! I have tested TypeScript in hobby projects with a very positive experience. I have actually used typescript together with angular once. I was very disappointed when angular announced that they were going to make some kind of fork, for the runtime annotations they needed, instead of working together.
- k_bx 12y agoUntil they tret null values as a separate type, I'm with Facebook Flow.
- the_gipsy 12y agoAlthough I haven't tried Flow, I have taken a glance at it's Maybe Types. I don't think that it is possible to work around libraries and browser APIs returning nulls, and undefined seems to be completely ignored. I think if you want to get rid of null/undefined then you have to use a complete different language, something like Elm, but I would welcome being proven wrong.
- k_bx 12y agoWhat do you mean it's not possible to work around libraries and APIs returning nulls? That's exactly the point I made, Flow solved it. Yes, they had to write interface for all browser APIs (and it's incomplete, PRs welcome), and in places where API might return null it states that it may return it. And your code has to deal with null and non-null cases explicitly (or at least put an if). You are right though that this type-system is much weaker than other languages like Elm or Haskell, and for me, being from a Haskell world, writing JS with Flow was still a disappointment. It's just that currently there's no better alternative I know in terms of interop with JS and good level of error-reporting.
- the_gipsy 12y ago> What do you mean it's not possible to work around libraries and APIs returning nulls? That's exactly the point I made, Flow solved it. Sorry, I had the really stupid misconception that Maybe Types could not be applied to libraries and browser APIs. So it seems like a good start, but it doesn't seem really useful if they aren't even in the basic API's descriptions: https://github.com/facebook/flow/blob/master/lib/dom.js#L198 https://github.com/facebook/flow/blob/master/lib/dom.js#L198
- evbots 12y agowtf
- cdnsteve 12y agoAngular.ts ...
- yawz 12y agoOh no!
- WhitneyLand 12y agoAngular 2 is having a lot of pushback and challenges, but this may be a positive. First, there have been hard feelings over breaking backward compatibility. To rub salt in the wound the new syntax doesn't seem to buy you much for many basic scenarios. If you are going to push big breaking changes you need to show big benefits that are easy to understand at a glance. Secondly, the Ember community started small but has been kicking ass for a while now and making many improvements that are compelling to developers. It's a modern framework, but also easier to understand than some competitors like react. I see the Typescript move as a positive because it shows they are at least trying to do what's right even when using tech from one of the biggest competitors. How this played internally at Google to overcome executive knee-jerk/bureaucracy/pettiness I don't know, but it's a good sign. The community has clearly spoken, and the future of Angular is now riding on how well they absorb and react to the feedback and advances from competing teams.
- deleted 12y ago[deleted]
- Firegarden 12y agoThe best part of this announcement is the reminder that Typescript is worth adopting. Sorry "Angular 2" your just not welcome in my leading edge reality.
- dominotw 12y ago>how well they absorb and react to the feedback and advances from competing teams. pun intended?
- pfooti 12y agoThe typescript move is more along the lines of "we had these extensions to typescript we were calling AtScript, but now they're included in the forthcoming release of TypeScript, so we'll just call it Typescript". It doesn't seem to actually change any on-the-ground syntax, just what you call the language. another, more important piece (IMO) of response to the pushback they've been getting came during the new router demo at ng-conf today. Apparently, you'll be able to mix-and-match ng2 and ng1 routes within the same router, so the commitment was: if you use the new router, there's a clear incremental upgrade path as you port parts of your app to ng2. I'm still in wait-and-see mode, but there's apparently also talk (from the same router talk) of tools to convert ui-router built routers to the new router, which would be double-rad. https://www.youtube.com/watch?v=vecg70fPDFw https://www.youtube.com/watch?v=vecg70fPDFw (the router talk in question)
- noobhater1000 12y agoTo be honest I feel like learning JSX is the Achilles heel to using ReactJS. Now Angular is forcing you to learn TypeScript? What's next, Polymer will make you learn Coffeescript? I like React except for JSX, since React seems to be headed in the all JSX direction I jumped ship to Polymer. I hate the idea of having to learn a proprietary language that boils down to straight JavaScript. I hate the extra compile, I hate the lack of dubugging support. Most of all, I hate the fragmented documentation when a project has straight JavaScript examples and other examples using some abstraction. Why is the web world doing this?
- skeeterbug 12y ago"Special shout out to Yehuda Katz, who helped us design the annotation+decorator proposal which helped make this work possible." How in the world does this man keep up with all these projects? He needs to write a book on motivation.
- deleted 12y ago[deleted]
- itsbits 12y agoexactly...i thght same when read that..
- coldtea 12y ago>How in the world does this man keep up with all these projects? He needs to write a book on motivation. By dumping them mid-way and getting to the next shiny one? Anybody knows how this RoR kickstarter project finally went?
- wycats 12y agoYep. I shipped Tokaido and people use it. It was mentioned on Ruby Weekly last week. You can get releases at https://github.com/tokaido/tokaidoapp/releases https://github.com/tokaido/tokaidoapp/releases. Andres (who now maintains the project) released Tokaido for Ruby 2.1 (with support for Mavericks) recently and we're working on Ruby 2.2 support as we speak. The org is here: https://github.com/tokaido/ https://github.com/tokaido/ and there are a number of auxiliary projects (muxr and tokaido-dns are the big ones) that I developed separately along the way.
- stubc 12y agoYou're a machine Yehuda.
- calgaryeng 12y agoBig ups for the "bigger man" type response :)
- 12y ago
- itsbits 12y agoOne of the reasons, people preferred Angular was its learning curve...now, its more or less equal to Ember or Knock out...
- pbowyer 12y agoIs TypeScript the new CoffeeScript?
- iends 12y agoNo, Coffeescript has always been crap. Typescript is getting better and better.
- DDcsidsIOIDp 12y agoNo, every javascript code compile in TypeScript. This is not a separate language, just javascript + static typing (if you want) All JS lib compile out of the box in TypeScript.
- ChicagoDave 12y agoMy brain just broke. I can't even imagine Google and Microsoft working together on anything as big as Angular. The Universe just took a 90 degree turn.
- shockzzz 12y agoRemember Angular Dart?
- seba_dos1 12y agoIt's still there and still will be in Angular 2.
- ahoge 12y agoAngular 2 is heavily inspired by AngularDart. Angular 2 has a single codebase for JS and Dart.
- dmak 12y agoSounds like they are trying to move people from Angular to Dart
- shadowmint 12y agoThe other way around. (oh! You meant as, in, externally, not internally. I see...)
- sebastianconcpt 12y agoDude you don't even virtual-dom
- tegeek 12y agoLooking at the example source code & having experience of AngularJs & TS, I would say this is a huge development in term of enterprise adoption. Statically typed, annotations, built-in dependency injection, comprehensive test support (easy to write testable code), declarative UIs, 100s of already available libraries & above all support from Google and Microsoft. I can say this with confidence that even with a complete rewrite & not backward compatible, AngularJS 2 with TS is going to be a huge success for everyone. And sooner or later, all other frameworks will adopt ECMA Script 6 because of standardisation of so many things (modules, classes etc.) I would also like to add that this is a very exciting time for JavaScript developers because there are so many things happening & companies of all sizes will keep investing good amount of money moderating their JS code bases.
- woah 12y agoYea, I'm super excited that the Angular team has given us ES6!
- Keats 12y agoAnyone successfully using typescript with react/flux? I found it a bit cumbersome to use with most of the flux implementations
- ethagnawl 12y agoHave you tried Flow? I would (naively, perhaps) assume it was meant to work well with the rest of the FB stack.
- Keats 12y agoBabel + Flow is the next combination I'm going to try
- jamesgpearce 12y agoThis presentation compares TypeScript & Flow for React: https://www.youtube.com/watch?v=9PTa9-PPVAc&list=PLb0IAmt7-GS1cbw4qonlQztYV1TAW0sCr&index=19 https://www.youtube.com/watch?v=9PTa9-PPVAc&list=PLb0IAmt7-G...
- andrewrice 12y agoAt this point, should a newcomer learn Angular 2 or stick to 1.*?
- plurby 12y agoHere is a nice introduction video to TypeScript from ng-conf 2015 https://www.youtube.com/watch?v=U7NYTKgkZgo https://www.youtube.com/watch?v=U7NYTKgkZgo
- arikrak 12y agoIf Google is promoting TypeScript, can they still promote Dart? How many alt-javascript's can one company promote?
- shadowmint 12y agoThey use it internally, but seriously as a platform for other people to use? Not really, no. ...then again, the 'dart community' has diminished to basically nothing, so I doubt many will care particularly.
- thomasfl 12y ago"Special shout out to Yehuda Katz, who helped us design the annotation+decorator proposal which helped make this work possible." The feverish Yehuda Katz is everywhere! But most importantly he is here on Hacker News and has close to 6000 https://news.ycombinator.com/user?id=wycats https://news.ycombinator.com/user?id=wycats
- jugularkill 12y agoThere's clearly a corporate agenda with 2.0 but who cares. The most important question is "Is this the best thing for my scenario?" Probably not but it has a name. There's too much talk about "typescript" and not enought about what problems Angular 2 solves compared to "not" having a ready made framework or how many problems it adds.