mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
38 lines
962 B
TypeScript
38 lines
962 B
TypeScript
//// [tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts] ////
|
|
|
|
//// [infiniteExpansionThroughInstantiation.ts]
|
|
// 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;
|
|
}
|
|
|
|
declare var list: List<string>;
|
|
declare var ownerList: OwnerList<string>;
|
|
list = ownerList;
|
|
|
|
function other<T>(x: T) {
|
|
var list: List<T>;
|
|
var ownerList!: OwnerList<T>;
|
|
list = ownerList;
|
|
|
|
}
|
|
|
|
|
|
//// [infiniteExpansionThroughInstantiation.js]
|
|
"use strict";
|
|
// instantiating a derived type can cause an infinitely expanding type reference to be generated
|
|
list = ownerList;
|
|
function other(x) {
|
|
var list;
|
|
var ownerList;
|
|
list = ownerList;
|
|
}
|