2014-07-13 01:04:16 +02:00
|
|
|
//// [maxConstraints.ts]
|
|
|
|
interface Comparable<T> {
|
|
|
|
compareTo(other: T): number;
|
|
|
|
}
|
|
|
|
interface Comparer {
|
|
|
|
<T extends Comparable<T>>(x: T, y: T): T;
|
|
|
|
}
|
|
|
|
var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y };
|
|
|
|
var maxResult = max2(1, 2);
|
|
|
|
|
|
|
|
//// [maxConstraints.js]
|
2015-02-07 05:03:24 +01:00
|
|
|
var max2 = function (x, y) { return (x.compareTo(y) > 0) ? x : y; };
|
2014-07-13 01:04:16 +02:00
|
|
|
var maxResult = max2(1, 2);
|