News for hackers. Stuff that matters.
Re:Announcing TypeScript 1.5 by pluma on Monday July 20, 2015 @01:11PM (#9917426)
Considering Babel solves most ES2015/2016 needs and has support for flow, what does TS still bring to the table for people who aren't using Visual Studio?

Serious question. I last looked at TS when it had plenty of warts (e.g. verbose metadata to make imports work, no real JS API) and since switched to Babel via JSX+harmony. Flow integrates nicely and seems to be better at understanding implicitly typed (legacy) code, too. TS's main selling points seem to be VS integration and Angular's blessings.

Re:Announcing TypeScript 1.5 by chimeracoder on Monday July 20, 2015 @03:00PM (#9918231)
> has support for flow

I've used both Typescript and Flow. In my experience, Typescript is far superior to Flow.

In terms of the sorts of errors they catch, they're about the same. In practice, Flow caught essentially no real errors that Typescript did not, and vice versa. (This is based on my workflow, YMMV obviously.)

However, Typescript is installable through NPM and runs as a basic Node module that reads files and parses text when you call it. Flow is written in OCaml, which means it's not available through NPM. This means either installing a separate binary (if one exists for your system) or installing an OCaml compiler so you can compile it from source. Afterwards, Flow uses a client-server setup, which makes it really annoying to run in a headless and automated environment. It's also surprisingly slow; it took a full ten seconds to typecheck a small project the first time. Supposedly the server makes it faster to do repeated checks, but honestly, the Typescript compiler is fast enough that this seems like a solution in search of a problem.

Also, Flow would keep getting confused and insisted on typechecking my node_modules. This was a problem because one of my imports had a third-level dependency with syntax error in an unused test, which meant that my entire Flow typecheck would fail. I couldn't add it to the [ignore] section of my ~/.flowconfig, because then Flow would literally pretend the file didn't exist, and then the project wouldn't compile due to missing imports!

All in all, I'm sure there's some way to set up flow without running into any of the above issues, but it definitely was way more work to set up (compared to a simple 'npm install'), and for seemingly no benefit whatsoever.

Re:Announcing TypeScript 1.5 by drinchev on Monday July 20, 2015 @01:19PM (#9917493)
I don't wanna say that, but a language created by such a large company, which is open-sourced since day one and developed by a team of professionals with a solid research before any lines of code have been written ... sounds a like a big thing on the table for may day-to-day choices in this sea of possibilities.
Re:Announcing TypeScript 1.5 by Guillaume86 on Monday July 20, 2015 @01:41PM (#9917667)
I'd like to try flow but it isn't available yet on windows [1] so it's not even an option for me (I'm on windows and I like to keep my things multi-platform friendly if possible). At the moment I'm using babel in Atom and typescript in VisualStudio.

[1] https://github.com/facebook/flow/issues/6

Re:Announcing TypeScript 1.5 by yareally on Monday July 20, 2015 @01:29PM (#9917578)
> what does TS still bring to the table for people who aren't using Visual Studio?what does TS still bring to the table for people who aren't using Visual Studio?

It doesn't require Visual Studio. Most major IDEs and some text editors have support either from Microsoft or the developers of the IDE/editor[1].

Also, strict typing (which I consider a huge plus for any long term large project to help make it sane).

I think it matters (though maybe not for everyone) that Anders Hejlsberg (of Delphi and C# creation fame) is behind the architecture of the language.

> no real JS API

Not sure what you mean by that, please clarify. JS notation works fine in it (since typescript is just a super set of JS and typing is optional). If you want to add types to a JS library, you just build an interface for it. Lots of examples of how to do that out there[2].

[1] https://github.com/Microsoft/TypeScript/wiki/TypeScript-Edit...

[2] https://github.com/borisyankov/DefinitelyTyped

Re:Announcing TypeScript 1.5 by pluma on Monday July 20, 2015 @01:32PM (#9917599)
> JS API

I mean a JS interface to the transpiler. At the time there was only the CLI, nothing that worked on strings or streams within node code.

> IDE support ... strict typing ...

Ditto for flow, though.

Re:Announcing TypeScript 1.5 by AntiRush on Monday July 20, 2015 @02:31PM (#9918019)
The compiler api has gotten a lot better: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compi...

If you just want string->string compilation, there's typestring, which wraps the api: https://www.npmjs.com/package/typestring

Re:Announcing TypeScript 1.5 by Keats on Monday July 20, 2015 @01:54PM (#9917761)
Last time I tried flow (maybe 6 months ago?), it didn't work very well for me. I can't remember the details unfortunately.

Typescript covers pretty much all the ES6 features that I use while flow is still missing let/const apparently. I only miss async/await and that should be in TS 1.6 so it's not a big deal for me and I believe you should be able to do a TS -> Babel -> ES5 workflow if you wanted by having ES6 as target for TS. For JSX, I prefer using React.DOM anyway but support will be in 1.6 and is already in master.

TS main selling point is DefinitelyTyped which means typing for pretty much all the third party code and the fact that it's been out for a couple of years now. A tool to convert .d.ts to flow definition has been on flow short-term todo list since november and without it, flow is not viable for me.

TS definitely shines when starting new projects though, it can be a bit annoying on a legacy codebase.

(I use Pycharm, not VS and it integrates well in it, minus lagging a bit behind versions)

Re:Announcing TypeScript 1.5 by pluma on Monday July 20, 2015 @04:26PM (#9918808)
Thanks for the insights. I haven't encountered any issues with third party code myself and don't mind the client/server model, but for me the killer app is Babel support (so flow is only a type checker, not another transpiler).

Do imports and import resolution work out of the box in TS these days? Last time I tried, I had to jump through hoops to get it to understand node imports and it wouldn't work without magical comments. I also don't want to have to wrap everything in module declarations -- the import logic of node should be sufficient. If TS has sorted these problems out, it might be worth another look for me.

Re:Announcing TypeScript 1.5 by Keats on Monday July 20, 2015 @06:22PM (#9919503)
You just have to declare which external module (3rd party dep) you are using so typescript knows how to apply typings.

Ie you can use ES6 imports, you just need to have a /// <reference path="../typings/all.d.ts" /> line or declare them in tsconfig.json now (I believe, haven't checked yet).

I agree the modules are tricky and my least favourite thing about TS though

Re:Announcing TypeScript 1.5 by pluma on Monday July 20, 2015 @08:14PM (#9919933)
Eh. Those magical comments were what turned me off using TS to begin with. If I'm importing stuff, I'm already declaring my dependencies. TS seems to prefer re-inventing the wheel whereas flow just builds on what is already there.

But that's just my (unfairly biased) impression.

EDIT: Shame Flow is written in OCaml rather than built on Node. That's the only thing I prefer about TS at this point.

Re:Announcing TypeScript 1.5 by nawitus on Monday July 20, 2015 @01:25PM (#9917544)
You don't need Visual Studio to have automatic refactoring and code-complete. Atom, for example, supports that.

TypeScript's benefits include all the generic benefits of type checking.

Re:Announcing TypeScript 1.5 by pluma on Monday July 20, 2015 @01:36PM (#9917632)
So it brings nothing that babel+flow doesn't do already? The only advantage I seem to find is being backed by MS and blessed by Angular (i.e. Google). Sorry if I sound dismissive. I'm just trying to figure out why so many seem to find TS exciting outside the MS sphere.
Re:Announcing TypeScript 1.5 by Guillaume86 on Monday July 20, 2015 @01:44PM (#9917693)
Flow is not available on windows, typescript is available on all major OSes.
Re:Announcing TypeScript 1.5 by nawitus on Monday July 20, 2015 @07:56PM (#9919871)
TypeScript is probably more refined and has better tooling than Flow as it's a lot older. One could ask what Flow brings to the table.