TypeScript/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt
2014-11-05 12:26:03 -08:00

41 lines
1.8 KiB
Plaintext

tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts(16,1): error TS2322: Type 'OwnerList<string>' is not assignable to type 'List<string>'.
Types of property 'data' are incompatible.
Type 'List<string>' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts(21,5): error TS2322: Type 'OwnerList<T>' is not assignable to type 'List<T>'.
Types of property 'data' are incompatible.
Type 'List<T>' is not assignable to type 'T'.
==== tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts (2 errors) ====
// instantiating a derived type can cause an infinitely expanding type reference to be generated
interface List<T> {
data: T;
next: List<T>;
owner: OwnerList<T>;
}
// will have an owner property that is an infinitely expanding type reference
interface OwnerList<U> extends List<List<U>> {
name: string;
}
var list: List<string>;
var ownerList: OwnerList<string>;
list = ownerList;
~~~~
!!! error TS2322: Type 'OwnerList<string>' is not assignable to type 'List<string>'.
!!! error TS2322: Types of property 'data' are incompatible.
!!! error TS2322: Type 'List<string>' is not assignable to type 'string'.
function other<T>(x: T) {
var list: List<T>;
var ownerList: OwnerList<T>;
list = ownerList;
~~~~
!!! error TS2322: Type 'OwnerList<T>' is not assignable to type 'List<T>'.
!!! error TS2322: Types of property 'data' are incompatible.
!!! error TS2322: Type 'List<T>' is not assignable to type 'T'.
}