flair icon indicating copy to clipboard operation
flair copied to clipboard

Stars & bookmarks

Open tmcw opened this issue 5 years ago • 1 comments

We can / should allow people to give their own ratings to cocktails, and mark ones they've tried.

tmcw avatar Apr 01 '20 23:04 tmcw

I think this is a good use case for building on the Flow comment syntax:

class Arc {
  /*::
  // description
  innerRadius: (d: Datum, ...args: any[]) => number;
  // description
  innerRadius: (radius: number) => this;
  // description
  innerRadius: (radius: (d: Datum, ...args: any[]) => number) => this;
  */
  innerRadius() {
    // ...
  }
}

jamiebuilds avatar Oct 13 '17 00:10 jamiebuilds

Note that in flow, I think the only way to do this for standalone functions is to use an intersection type on a function expression:

const minus: ((number, number) => number) & ((number) => number)) = function(x, y) { return typeof y === 'number' ? x - y : -x; }

AFAIK you can't correctly annotate a function declaration (function minus() {}) with multiple signatures

anandthakker avatar Oct 13 '17 12:10 anandthakker

@anandthakker Yeah that's correct for standalone functions (except for in type declaration files)

jamiebuilds avatar Oct 13 '17 23:10 jamiebuilds