• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1declare module linq {
2
3    interface Enumerable<T> {
4        OrderByDescending(keySelector?: string): OrderedEnumerable<T>;
5        GroupBy<TKey>(keySelector: (element: T) => TKey): Enumerable<Grouping<TKey, T>>;
6        GroupBy<TKey, TElement>(keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement): Enumerable<Grouping<TKey, TElement>>;
7        ToDictionary<TKey>(keySelector: (element: T) => TKey): Dictionary<TKey, T>;
8    }
9
10    interface OrderedEnumerable<T> extends Enumerable<T> {
11        ThenBy<TCompare>(keySelector: (element: T) => TCompare): OrderedEnumerable<T>; // used to incorrectly think this was missing a type argument
12    }
13
14    interface Grouping<TKey, TElement> extends Enumerable<TElement> {
15        Key(): TKey;
16    }
17
18    interface Lookup<TKey, TElement> {
19        Count(): number;
20        Get(key): Enumerable<any>;
21        Contains(key): boolean;
22        ToEnumerable(): Enumerable<Grouping<TKey, any>>;
23    }
24
25    interface Dictionary<TKey, TValue> {
26        Add(key: TKey, value: TValue): void;
27        Get(ke: TKey): TValue;
28        Set(key: TKey, value: TValue): boolean;
29        Contains(key: TKey): boolean;
30        Clear(): void;
31        Remove(key: TKey): void;
32        Count(): number;
33        ToEnumerable(): Enumerable<KeyValuePair<TKey, TValue>>;
34    }
35
36    interface KeyValuePair<TKey, TValue> {
37        Key: TKey;
38        Value: TValue;
39    }
40}
41