84 lines
1.6 KiB
Text
84 lines
1.6 KiB
Text
=== tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts ===
|
|
class List<T> {
|
|
>List : List<T>
|
|
>T : T
|
|
|
|
data: T;
|
|
>data : T
|
|
>T : T
|
|
|
|
next: List<List<T>>;
|
|
>next : List<List<T>>
|
|
>List : List<T>
|
|
>List : List<T>
|
|
>T : T
|
|
}
|
|
|
|
class DerivedList<U> extends List<U> {
|
|
>DerivedList : DerivedList<U>
|
|
>U : U
|
|
>List : List<U>
|
|
>U : U
|
|
|
|
foo: U;
|
|
>foo : U
|
|
>U : U
|
|
|
|
// next: List<List<U>>
|
|
}
|
|
|
|
class MyList<T> {
|
|
>MyList : MyList<T>
|
|
>T : T
|
|
|
|
data: T;
|
|
>data : T
|
|
>T : T
|
|
|
|
next: MyList<MyList<T>>;
|
|
>next : MyList<MyList<T>>
|
|
>MyList : MyList<T>
|
|
>MyList : MyList<T>
|
|
>T : T
|
|
}
|
|
|
|
var list: List<number>;
|
|
>list : List<number>
|
|
>List : List<T>
|
|
|
|
var list2: List<string>;
|
|
>list2 : List<string>
|
|
>List : List<T>
|
|
|
|
var myList: MyList<number>;
|
|
>myList : MyList<number>
|
|
>MyList : MyList<T>
|
|
|
|
var xs = [list, myList]; // {}[]
|
|
>xs : List<number>[]
|
|
>[list, myList] : List<number>[]
|
|
>list : List<number>
|
|
>myList : MyList<number>
|
|
|
|
var ys = [list, list2]; // {}[]
|
|
>ys : (List<number> | List<string>)[]
|
|
>[list, list2] : (List<number> | List<string>)[]
|
|
>list : List<number>
|
|
>list2 : List<string>
|
|
|
|
var zs = [list, null]; // List<number>[]
|
|
>zs : List<number>[]
|
|
>[list, null] : List<number>[]
|
|
>list : List<number>
|
|
>null : null
|
|
|
|
var myDerivedList: DerivedList<number>;
|
|
>myDerivedList : DerivedList<number>
|
|
>DerivedList : DerivedList<U>
|
|
|
|
var as = [list, myDerivedList]; // List<number>[]
|
|
>as : List<number>[]
|
|
>[list, myDerivedList] : List<number>[]
|
|
>list : List<number>
|
|
>myDerivedList : DerivedList<number>
|
|
|