News for hackers. Stuff that matters.
Re:Why We Chose Typescript by danmaz74 on Saturday July 01, 2017 @08:28AM (#14676819)
Between Flow and Typescript, looks like the latter has all the momentum. But I see one way in which Flow could become relevant again: by becoming 100% compatible with plain JS.

I would love to have type checking, but I'm weary of solutions that aren't really JS, and could fall out of favor or lack good support in the future. I'm pretty sure I'm not the only one.

But Flow type annotations don't really need an incompatible syntax AFAIK; they could just use comments. This way, we wouldn't need to worry about the future of Flow. If the projects dies off or becomes redundant, we're just left with some useful comments - no need to rewrite or transpile our code to native JS.

PS I found an existing project which does this [1], but it requires an additional step and it isn't officially supported. It looks incredibly easy to make Flow work directly with pure JS with comments...

[1] https://github.com/Kegsay/flow-jsdoc

Re:Why We Chose Typescript by moogly on Saturday July 01, 2017 @10:50AM (#14677340)
Re:Why We Chose Typescript by danmaz74 on Saturday July 01, 2017 @01:02PM (#14677867)
Thanks, but from a bit of research it's not clear to me: does this mean that it's possible to use TypeScript to type-check javascript files which include these annotations, without using .ts at all?
Re:Why We Chose Typescript by moogly on Saturday July 01, 2017 @04:43PM (#14678907)
Yes, by using --allowJS and --checkJS switches (can also be set in tsconfig.json).
Re:Why We Chose Typescript by danmaz74 on Sunday July 02, 2017 @03:36AM (#14681365)
Thanks a lot - will try this!
Re:Why We Chose Typescript by moomin on Saturday July 01, 2017 @08:54AM (#14676899)
The big thing I liked about Flow over TypeScript was the more accurate type checking. 2.4 looks like it has finally fixed that.