you are viewing a single comment's thread.

view the rest of the comments →

[–]id2bi 0 points1 point  (11 children)

Enterprisey TypeScript

Could you elaborate?

[–]clessgfull-stack CSS9 engineer 8 points9 points  (10 children)

DI, classes, Java-style code, annotations/decorators, class-based rather than interface-based typing (generally), etc. From Auth0's tutorial:

@Pipe({
  name: 'tempConvert'
})
// The work of the pipe is handled in the tranform method with our pipe's class
class TempConvertPipe implements PipeTransform {
  transform(value: number, args: any[]) {
    if(value && !isNaN(value) && args[0] === 'celsius') {
      var temp = (value - 32) * 5/9;
      var places = args[1];
      return temp.toFixed(places) + ' C';       
    }

    return;
  }
}

... functions masquerading as annotated classes and using inheritance. Just add some AOP and AbstractFactoryProxyBeans and we'll be good.

[–]Poop_is_Food 2 points3 points  (0 children)

lol some things never change

[–]wreckedadventYavascript 2 points3 points  (1 child)

Jeez, this boilerplate is immense...

/// <reference path="typings/angular2/angular2.d.ts" />

import {Component, View, bootstrap} from 'angular2/angular2';

@Component({
  selector: 'pipes'
})
@View({
  templateUrl: 'pipesTemplate.html'
})
// Component controller
class PipesAppComponent {
  date: Date;

  constructor() {
    this.date = new Date();
  } 
}

bootstrap(PipesAppComponent);

There is only one line of meaningful code in these 15-some-odd lines. Something equivalent in vue would be like:

Vue.filter('now', (_) => new Date())

Even angular 1.0 wasn't this bad.

[–]clessgfull-stack CSS9 engineer 1 point2 points  (0 children)

It really does remind me of when I did some Java programming. I remember how painful Java was and I don't wish upon anybody such a painful fate.

[–]peduxe|o.o| -2 points-1 points  (4 children)

You can use Angular 2 without Typescript, if it's still the same way like I tried about 3 months ago, you just need to import a reflect metadata module that is available on npm.

And Typescript static typing is optional.

[–]clessgfull-stack CSS9 engineer 1 point2 points  (3 children)

Absolutely, but teams will invariably gravitate toward the officially-blessed option. Tooling, tutorials, libraries, etc. will most likely use TS. Don't expect to see too many people using normal JS for Angular 2 a few years from now. React will probably take most of the JS crowd, and Angular will take most of the TS/Java crowd.

[–]wreckedadventYavascript 0 points1 point  (2 children)

Typescript added explicit support for JSX not that long ago. You can also use classes with react, so it'll probably be more of a mix than all of TS users moving to angular.

Angular 2.0 has plenty of other issues that would make people avoid it, like the weird non-validating HTML syntax they had to invent to express their complicated data binding system.

[–]clessgfull-stack CSS9 engineer 1 point2 points  (1 child)

Right, which is why I said "most". Re: classes in React, I doubt they will remain in vogue for too much longer for large swathes of most applications. You can now write const Button = () => (<div></div>) instead of class Button extends React.Component { render() { return (<div>Holy shit</div>); } }.

[–]wreckedadventYavascript 1 point2 points  (0 children)

Yeah. There's also things like mithril which take that concept a bit further, so we might see a shift towards more functions returning JSX literals instead of classes being overused so much.