神刀安全网

TypeScript Won

TypeScript won

I love all the people (great developers!) and the technologies (great ideas!) mentioned in this post :rose:. That said I wouldn’t write this if I didn’t believe in it. Also its not a competition. But you need to make a choice for your project and that is where the winning comes in.

You might be a few years in the future where this isn’t even a question. But its a question right now:

TypeScript vs. ES6

ES6 is TypeScript. Here is a venn diagram to help you understand.

TypeScript Won

Overtime it will be more than ES6 maybe something like ES2017. But the same principle will apply, because of TypeScript’s design goals . Its going to be a superset of JavaScript next. Perhaps the question you have is:

TypeScript vs. Babel

They are not the same thing. Babel is a transpiler. TypeScript is a transpiler + type checker.

The following is ES6 (or whatever is the current ES). This code is both valid TypeScript and valid Babel.

const foo = 123; // or any other code you want

Nothing against Babel. Babel is awesome! Some of the ideas from Babel (plug-gable transformer based emitter) are actually being brought into TypeScript. But in the end if all you need is a transpiler you can use TypeScript or Babel. If you need a Type system, you’d want TypeScript. And indeed the issues of managing large JavaScript code bases are more than just having a great syntax to destructure objects. The Babel vs. TypeScript trends show this shift:

You want static analysis. That’s the reason why AngularJS adopted TypeScript as their language of choice.

The greatest adaption of Babel has been by the ReactJS community (an awesome bunch). But TypeScript supports ReactJS out of the box too!

And there is increasing community acceptance of this fact e.g. redux ships with TypeScript definitions .

But JavaScript will get type annotations

Maybe someday. But even that is unlikely. Experiments have failed .

Also these experiments are following TypeScript’s suite in terms of syntax. TypeScript really has become the defacto syntax for type annotations thanks to an amazing community of type definition authors .

For further future proofing I’d rather let a TypeChecking compiler do the transpilation for me than one that treats everything as dynamic.

Also you need to create your project today not tomorrow.

TypeScript vs. CoffeeScript

Its not even a question anymore. Once ESNext => ESNow transpilation became popular CoffeeScript interest quickly deteriorated. Just look at the google trend :

TypeScript Won

CoffeeScript was awesome too. It still has some stuff like the elvis operator that we hope makes it into JavaScript (and by effect into TypeScript!).

TypeScript vs. Dart

Dart is not JavaScript. TypeScript is. And there is no stopping the sheer momentum of JavaScript code / developers out there. Not necessarily the best thing to happen to humanity but its a reality. The decimal system wasn’t great either but we all use it. Everybody needs to deal with JavaScript. TypeScript helps you do that.

The same arguments hold for a few other less popular options e.g. PureScript / Elm. Great ideas. But not enough traction compared to TypeScript .

I’ve been convincing and helping JavaScript developers move to TypeScript for a few years . I don’t feel the need to do that anymore. I believe TypeScript will reach amazing adoption whether I am here or not. TypeScript seems to be synonymous with ES6 at least for some people :

TypeScript Won

TypeScript won .

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » TypeScript Won

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址