75 lines
1.4 KiB
Text
75 lines
1.4 KiB
Text
=== tests/cases/compiler/infinitelyExpandingTypes4.ts ===
|
|
interface Query<T> {
|
|
>Query : Query<T>
|
|
>T : T
|
|
|
|
// ...
|
|
groupBy<K>(keySelector: (item: T) => K): Query<Grouping<K, T>>;
|
|
>groupBy : <K>(keySelector: (item: T) => K) => Query<Grouping<K, T>>
|
|
>K : K
|
|
>keySelector : (item: T) => K
|
|
>item : T
|
|
>T : T
|
|
>K : K
|
|
>Query : Query<T>
|
|
>Grouping : Grouping<K, T>
|
|
>K : K
|
|
>T : T
|
|
|
|
// ...
|
|
}
|
|
|
|
interface QueryEnumerator<T> {
|
|
>QueryEnumerator : QueryEnumerator<T>
|
|
>T : T
|
|
|
|
// ...
|
|
groupBy<K>(keySelector: (item: T) => K): QueryEnumerator<Grouping<K, T>>;
|
|
>groupBy : <K>(keySelector: (item: T) => K) => QueryEnumerator<Grouping<K, T>>
|
|
>K : K
|
|
>keySelector : (item: T) => K
|
|
>item : T
|
|
>T : T
|
|
>K : K
|
|
>QueryEnumerator : QueryEnumerator<T>
|
|
>Grouping : Grouping<K, T>
|
|
>K : K
|
|
>T : T
|
|
|
|
// ...
|
|
}
|
|
|
|
interface Grouping<K, T> extends Query<T> {
|
|
>Grouping : Grouping<K, T>
|
|
>K : K
|
|
>T : T
|
|
>Query : Query<T>
|
|
>T : T
|
|
|
|
key(): K;
|
|
>key : () => K
|
|
>K : K
|
|
}
|
|
|
|
var q1: Query<number>;
|
|
>q1 : Query<number>
|
|
>Query : Query<T>
|
|
|
|
var q2: QueryEnumerator<number>;
|
|
>q2 : QueryEnumerator<number>
|
|
>QueryEnumerator : QueryEnumerator<T>
|
|
|
|
var q3: Query<number>;
|
|
>q3 : Query<number>
|
|
>Query : Query<T>
|
|
|
|
q1 = q2; // should error
|
|
>q1 = q2 : QueryEnumerator<number>
|
|
>q1 : Query<number>
|
|
>q2 : QueryEnumerator<number>
|
|
|
|
q1 = q3; // should not error
|
|
>q1 = q3 : Query<number>
|
|
>q1 : Query<number>
|
|
>q3 : Query<number>
|
|
|