News for hackers. Stuff that matters.
Re:Announcing TypeScript 2.2 by danmaz74 on Wednesday February 22, 2017 @06:03PM (#13710091)
Talking about flow, I was wondering: couldn't something like that be implemented just with comments, leaving us with actually 100% valid javascript? Eg:

  // @param somestring [String] yadda yadda
  // @return [Boolean]
  function somefunction(somestring) {
    // @type [Boolean]
    var ret;

    ...

    return ret;
  }
This would remove any type of "lock in" if you want to use it...
Re:Announcing TypeScript 2.2 by xymostech on Wednesday February 22, 2017 @08:00PM (#13710743)
Flow actually explicitly allows this[1] by just /* */ commenting out the flow type signatures. We use this in Aphrodite's code base[2] and it works pretty well.

[1]: https://flowtype.org/blog/2015/02/20/Flow-Comments.html

[2]: https://github.com/Khan/aphrodite/blob/master/src/generate.j...

Re:Announcing TypeScript 2.2 by insin on Wednesday February 22, 2017 @06:19PM (#13710203)
I'd prefer that approach too, as I can also document things at the same time as providing type annotations; flow-jsdoc looks interesting, but I don't know how easy it would be to plug into a Babel/Webpack+Babel workflow:

https://github.com/Kegsay/flow-jsdoc

Re:Announcing TypeScript 2.2 by damncabbage on Wednesday February 22, 2017 @08:04PM (#13710766)
There's also comments support in Flow directly, but it's sadly (but understandably) hideous:

  function somefunction(somestring/*: string*/)/*: boolean */ {
     var ret/*: boolean */;
     ...
     return ret;
  }
(See https://flowtype.org/blog/2015/02/20/Flow-Comments.html)
Re:Announcing TypeScript 2.2 by Lio on Thursday February 23, 2017 @05:31AM (#13712880)
Might be worth pointing out, the "documentation" package[1] can be used to generate jsdoc annotations suitable for Google Closure compiler from Flow type annotations.

It can also build really nice HTML documentation to.

[1] https://www.npmjs.com/package/documentation