File: chainedSpecializationToObjectTypeLiteral.js

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (17 lines) | stat: -rw-r--r-- 642 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//// [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;
var s2 = s.groupBy(function (s) { return s.length; });
var s3 = s2.each(function (x) { x.key; /* Type is K, should be number */ });