2014-07-13 01:04:16 +02:00
|
|
|
//// [chainedSpecializationToObjectTypeLiteral.ts]
|
|
|
|
interface Sequence<T> {
|
|
|
|
each(iterator: (value: T) => void): void;
|
|
|
|
map<U>(iterator: (value: T) => U): Sequence<U>;
|
|
|
|
filter(iterator: (value: T) => boolean): Sequence<T>;
|
|
|
|
groupBy<K>(keySelector: (value: T) => K): Sequence<{ key: K; items: T[]; }>;
|
|
|
|
}
|
|
|
|
|
|
|
|
var s: Sequence<string>;
|
|
|
|
var s2 = s.groupBy(s => s.length);
|
|
|
|
var s3 = s2.each(x => { x.key /* Type is K, should be number */ });
|
|
|
|
|
|
|
|
|
|
|
|
//// [chainedSpecializationToObjectTypeLiteral.js]
|
|
|
|
var s;
|
2015-03-09 02:23:23 +01:00
|
|
|
var s2 = s.groupBy(function (s) {
|
|
|
|
return s.length;
|
|
|
|
});
|
|
|
|
var s3 = s2.each(function (x) {
|
|
|
|
x.key; /* Type is K, should be number */
|
|
|
|
});
|