flair
flair copied to clipboard
Stars & bookmarks
We can / should allow people to give their own ratings to cocktails, and mark ones they've tried.
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() {
// ...
}
}
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 Yeah that's correct for standalone functions (except for in type declaration files)