News for hackers. Stuff that matters.
Re:Lisp Hackers: Marijn Haverbeke by hkolek on Tuesday April 03, 2012 @09:01AM (#3792709)
The google closure compiler does this. You can optionally annotate your javascript functions with type information (JavaDoc style) and the compiler will enforce it. For example:

  /**
   * @param {Function} fn
   * @param {string|null|undefined} str
   */
  foo.bar = function(fn, str) {
      // do something
  }
It is pretty powerful, you can also do some generics-like stuff like "@param {Array.<string>}" to enforce an array with only strings as elements.

There are no comments on this comment yet.