Live data from Hacker News

Announcing TypeScript 2.2

blogs.msdn.microsoft.com

31–40 of 123 posts

Re: Announcing TypeScript 2.2

#31

I know this probably comes up each typescript thread, but I still cannot figure out why I should use TS instead of flow + es6, and maintaining the typing definitions always discourages me as it's one more thing that needs to be kept up to date. Am I working on old information here?

With the last release (2.1) maintaining typing definitions is mostly as optional as Flow, because TS now just assumes imports it cannot find are `any` type.

A lot of typings are now directly inside the NPM packages of the libraries themselves and install "automatically" for you; many other typings can be searched on NPM (primarily the @types/ scope).

Re: Announcing TypeScript 2.2

#32
post #17
post #13

Speaking of tooling -- has anyone had a good experience with Typescript in IntelliJ/Webstorm? It does a fantastic job figuring out ES6 code but seems to totally choke on Typescript. I'd like to avoid switching to Visual Studio.

Make sure you turn on the native TypeScript Language Service feature, otherwise you'll be getting your IDE's parser, which is always behind the standard and doesn't work very well: > Select the Use TypeScript Service check box to get native support from the TypeScript Language Service according to the up-to-date specifications. In this case syntax and error highlighting is performed based on the annotations retrieved…

Well that solved some problems (e.g. importing from react-router/lib/*) but autocomplete for TSX is non-functional. Still pretty frustrating considering ES6 works out of the box.

Re: Announcing TypeScript 2.2

#33
post #27
post #24

Earlier quoted context omitted.

Why would flow + es6 be better?

Avoid vendor locking. Someday in near future if you don't like flow anymore, you can just strip all type annotations with Babel and move on. You are not risking ending up like coffeescript.

TypeScript compiles to JS in a straightforward manner as well. If you wanted to move away from TS, you could simply have the TS compiler compile to ES6 and you're done.

Re: Announcing TypeScript 2.2

#34
post #13

Speaking of tooling -- has anyone had a good experience with Typescript in IntelliJ/Webstorm? It does a fantastic job figuring out ES6 code but seems to totally choke on Typescript. I'd like to avoid switching to Visual Studio.

The inspections, autocomplete, and auto-import suggestions work great for me, but it doesn't seem to have that "show type on hover" functionality (not even Ctrl+hover, or quick documentation show it), that VSCode and even the online Monaco editor on http://www.typescriptlang.org/play/ have.

Re: Announcing TypeScript 2.2

#35
post #24

Earlier quoted context omitted.

Why would flow + es6 be better?

One reason flow might be considered "better" (context is key) is that it plays well with the babel ecosystem, letting one pick and choose their language features.

Typescript and Babel play well together, too.

Re: Announcing TypeScript 2.2

#36

I know this probably comes up each typescript thread, but I still cannot figure out why I should use TS instead of flow + es6, and maintaining the typing definitions always discourages me as it's one more thing that needs to be kept up to date. Am I working on old information here?

I'm not sure this answers your question, but:

I've been working with TS for the past couple of years but now I'm working on a Flow project.

Flow doesn't even compare. It falls short on many things TS would immediately flag, and just feels less thought-out (subjective I know). Tooling support is terrible and while not the language's fault, it means it just doesn't help you as much as it could. Using Flow basically becomes an afterthought, a part of your build step, while with TS it's much easier to have that integrated into your development flow (via your editor of choice).

And honestly, some of the decisions around the language just feel strange. Not knowing what kind of bool to use [0] is pretty emblematic of where it is going as a language.

To me Flow is just half-helping in a way that TS is fully devoted to.

[0] http://stackoverflow.com/questions/40618817/flow-bool-boolea...

Re: Announcing TypeScript 2.2

#37

I know this probably comes up each typescript thread, but I still cannot figure out why I should use TS instead of flow + es6, and maintaining the typing definitions always discourages me as it's one more thing that needs to be kept up to date. Am I working on old information here?

I don't get the 'maintaining type definitions is hard' argument. It's super easy to do, especially when coupled with typewriter which will automatically generate types for your server side DTOs. Also having typings saves you an incredible amount of time with fast refactoring, auto-complete, and of course the type checking which saves countless hours of debugging the dumbest mistakes.

When you start talking about getting into code bases that you didn't personally write. The time savings and productivity benefits that TypeScript brings are immense.

Re: Announcing TypeScript 2.2

#38
post #27
post #24

Earlier quoted context omitted.

Why would flow + es6 be better?

Avoid vendor locking. Someday in near future if you don't like flow anymore, you can just strip all type annotations with Babel and move on. You are not risking ending up like coffeescript.

That's an objectively incorrect assertion if you're applying that to TypeScript.

The same can be done to it that would be done to Flow: you can just either strip types manually, or just do a single export to your ECMAScripttarget of choice. It'll be native JavaScript. Even the little shims/polyfills it does (to support older ECMAScript versions if you wish to export to it) are optional and can be disabled.

Re: Announcing TypeScript 2.2

#39
post #27

Earlier quoted context omitted.

Avoid vendor locking. Someday in near future if you don't like flow anymore, you can just strip all type annotations with Babel and move on. You are not risking ending up like coffeescript.

Also, you can progressively opt in to add typing information, while still getting most of the benefits without.

The same can be done with TypeScript. Type inference has been added to it in 2015.

Re: Announcing TypeScript 2.2

#40
post #27

Earlier quoted context omitted.

Avoid vendor locking. Someday in near future if you don't like flow anymore, you can just strip all type annotations with Babel and move on. You are not risking ending up like coffeescript.

That's an objectively incorrect assertion if you're applying that to TypeScript. The same can be done to it that would be done to Flow: you can just either strip types manually, or just do a single export to your ECMAScripttarget of choice. It'll be native JavaScript. Even the little shims/polyfills it does (to support older ECMAScript versions if you wish to export to it) are optional and can be disabled.

TypeScript has `--target ESNext` this will strip out any TypeScript-specific type annotations, and leave you with standard-track-only JS code that looks identical to your input (modulo type annotations).
Post reply on HN